Created
October 4, 2010 05:17
-
-
Save dpogue/609270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.socialtext; | |
class SignalParameters | |
{ | |
public enum Fields | |
{ | |
kBefore, | |
kAfter, | |
kLimit, | |
kOrder, | |
kDirect; | |
} | |
private int bitVector = 0; | |
private Date fBefore; | |
private Date fAfter; | |
private int fLimit; | |
private String fOrder; | |
private boolean fSent; | |
private boolean fReceived; | |
public void setBefore(Date before) | |
{ | |
fBefore = before; | |
bitVector |= (1 << Fields.kBefore.ordinal()); | |
} | |
public void setAfter(Date after) | |
{ | |
fAfter = after; | |
bitVector |= (1 << Fields.kAfter.ordinal()); | |
} | |
public int getFields() | |
{ | |
return bitVector; | |
} | |
public Date getBefore() | |
{ | |
return fBefore; | |
} | |
} | |
/* Used like this: */ | |
getSignals(SignalParameters params) | |
{ | |
String url = ""; | |
int fields = params.getFields(); | |
if (fields & SignalParameters.Fields.kBefore.ordinal() != 0) | |
{ | |
url += "before=" + DateFormatter(params.getBefore()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment