text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void broadcast(Command command) {
List<ICallbackClient> m_clients = m_subscriber.getClients();
for (int i = 0; i < m_clients.size(); ++i) {
try {
m_clients.get(i).pushMessage(command);
} catch (RemoteException e ){
e.printStackTrace();
} catch(InterruptedException e){
e.printStackTrace(... | 3 |
public static void main(String[] args) {
double above = 0.7, below = 0.4;
float fabove = 0.7f, fbelow = 0.4f;
System.out.println("(int)above: " + (int)above);
System.out.println("(int)below: " + (int)below);
System.out.println("(int)fabove: " + (int)fabove);
System.out.println("(int)fbelow: " + (int)fbelow)... | 0 |
public void testEra() {
assertEquals(1, CopticChronology.AM);
try {
new DateTime(-1, 13, 5, 0, 0, 0, 0, COPTIC_UTC);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
static void destroy(Object instance) {
Class<? extends Object> clazz = instance.getClass();
invokeMethodWithAnnotation(clazz, instance, PreDestroy.class
);
} | 1 |
@Test
public void dijkstraSimplePossible() {
Graph g = testGraph1();
Vertex[] expected = new Vertex[2];
for (int i = 0; i < expected.length; i++) {
expected[i] = g.getVertices().get(i);
}
Vertex[] actual = new Vertex[2];
} | 1 |
@Override
public boolean verifier() throws SemantiqueException {
super.verifier();
if(gauche.isBoolean()){
setBoolean();
if(!droite.isBoolean()) GestionnaireSemantique.getInstance().add(new SemantiqueException("Expression droite arithmetique, booleenne attendue pour le OU lig... | 3 |
public static pgrid.service.corba.PeerReference[] read (org.omg.CORBA.portable.InputStream istream)
{
pgrid.service.corba.PeerReference value[] = null;
int _len0 = istream.read_long ();
value = new pgrid.service.corba.PeerReference[_len0];
for (int _o1 = 0;_o1 < value.length; ++_o1)
value[_o1] =... | 1 |
@Override
public String toString(){
String toReturn = "";
for(int i = 0; i<this.size;i++){
toReturn += DNSDB.IPToString(this.keys[i]);
toReturn+= " -> ";
toReturn += this.values[i];
toReturn+= "\n";
}
if(this.nextLeaf != null){
toReturn+= this.nextLeaf.toString();
}
return toReturn;
} | 2 |
private boolean alg_s1() {
switch (alg_pos) {
case 0:
return alg_set(0, 0);
case 1:
if (alg_get(1, 1) != 0) {
return alg_set(2, 2);
}
if (alg_get(0, 1) != 0 || alg_get(0, 2) != 0) {
return alg_set(2, 0);
}
return alg_set(0, 2);
case 2:
if (alg_get(2, 0) != 0 || (alg_get(... | 8 |
public void run() {
File file = new File(outputLoc.getAbsolutePath() + File.separatorChar + audio.getFileName());
File fileTmp = new File(outputLoc.getAbsolutePath() + File.separatorChar + audio.getFileName() + ".vkadl");
if (file.exists()) {
System.out.println("Skipping " + audio.getFileName()... | 5 |
public String buscarProspectoPorNombre(String name){
//##########################CARGA_BASE DE DATOS#############
tablaDeProspectos();
//##########################INGRESO_VACIO###################
if(name.equals("")){
name = "No busque nada";
resu... | 5 |
public Descriptor compile(SymbolTable symbolTable) {
// prevent overriding of constants
if (key instanceof IdentNode && symbolTable.descriptorFor(((IdentNode) key).getIdentName()) instanceof IntConstDescriptor) {
throw new CompilerException("Constant " + ((IdentNode) key).getIdentName() + " cannot be overriden")... | 5 |
private static Method getMethod(Class<?> cl, String method) {
for (Method m : cl.getMethods()) {
if (m.getName().equals(method)) {
return m;
}
}
return null;
} | 3 |
public Integer getInteger() {
Object gotValue=getValue();
if (gotValue != null) {
if (!Integer.class.isAssignableFrom(gotValue.getClass())) {
throw new ClassCastException("don't know how to convert "
+gotValue.getClass().getName()+" to Integer");
... | 2 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == valide) {
joueur1 = new Joueur(jtf1.getText(), Pion.JOUEUR1);
joueur2 = new Joueur(jtf2.getText(), Pion.JOUEUR2);
gestionnaireScore = new Score(joueur1, joueur2);
model = new PartieIHM(joueur1, joueur2, gestionnaireScore);
demande.setVis... | 6 |
public void askRemoveInventoryItem(Command command)
{
int inventoryItem;
if(!command.hasSecondWord()) {
// if there is no second word, we don't know what to remove
System.out.println("Verwijder wat?");
return;
}
//Try if input if ... | 4 |
public static String trimWhitespace(String str) {
if (!hasLength(str)) {
return str;
}
StringBuilder sb = new StringBuilder(str);
while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) {
sb.deleteCharAt(0);
}
while (sb.length() > 0 && Character.isWhitespace... | 5 |
public void execute() {
String line = null;
try { dout.runQueue(); } catch (Exception e) { log.catching(Level.WARN, e); }
Thread.interrupted();
dout.setEnabled(true);
try {
line = reader.readLine("> ", null);
} catch (IOException e) {
if (e.getCause() instanceof InterruptedException) {
try {... | 7 |
@Override
public void doAlgorithm() {
GraphModel g = graphData.getGraph();
step("start the algorithm.");
String str = JOptionPane.showInputDialog(null,
"Enter the homomorphism map size: ",
"Homomorphism Size", 1);
int mapSize = Integer.parseInt(str);
... | 8 |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
LinkedList<String> paramList = new LinkedList<String>();
Utils.addArrayToList(paramList, args);
Iterator<String> it = paramList.iterator();
if("db".equalsIgnoreCase(cmd.getName())) {
if... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Produto other = (Produto) obj;
if (this.Id != other.Id) {
return false;
}
if ... | 8 |
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode(0);
ListNode p = dummy;
while(l1 != null && l2 != null){
if(l1.val < l2.val){
p.next = l1;
l1 = l1.next;
}else{
p.next = l2;
... | 5 |
public void generateVerticalCorridor(MapRegion room1, MapRegion room2, String[][] dungeon)
{
// Etäisyys lähekkäimpien seinien välillä
int distance = room2.getY1() - room1.getY2();
// Valitaan alku- ja loppukoordinaatit siten, että polku ei koskaan kulje huoneen kulmasta
int startX =... | 6 |
public static byte[] encryptBloc(byte[] in) {
byte[] tmp = new byte[in.length];
byte[][] state = new byte[4][Nb];
for (int i = 0; i < in.length; i++)
state[i / 4][i % 4] = in[i%4*4+i/4];
state = AddRoundKey(state, w, 0);
for (int round = 1; round < Nr; round++) {
state = SubBytes(state);
sta... | 3 |
protected void gmcpSaySend(String sayName, MOB mob, MOB target, CMMsg msg)
{
if((mob.session()!=null)&&(mob.session().getClientTelnetMode(Session.TELNET_GMCP)))
{
mob.session().sendGMCPEvent("comm.channel", "{\"chan\":\""+sayName+"\",\"msg\":\""+
MiniJSON.toJSONString(CMLib.coffeeFilter().fullOutFilter(nul... | 8 |
protected boolean[] datasetIntegrity(
boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredictor,
boolean multiInstance,
int classType,
boolean predictorMissing,
boolean classMissing) {
... | 9 |
public Block(Color color, boolean isSolid) {
this.color = color;
this.isSolid = isSolid;
} | 0 |
public void updateSubTypes() {
if (!staticFlag)
subExpressions[0].setType(Type.tSubType(classType));
} | 1 |
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
//codigo guardar
if (principal != null) {
if (fichero == null) {
guardarComo();
} else {
guardar();
}
}
}//... | 2 |
public List<ConversionMessage> run(PageLayout layout, boolean checkOnly) {
List<ConversionMessage> messages = new ArrayList<ConversionMessage>();
//Regions
for (ContentIterator it = layout.iterator(null); it.hasNext(); ) {
Region reg = (Region)it.next();
//Primary and secondary Script
if (reg.getT... | 6 |
public String itsHere(MOB mob, Room R)
{
if(R==null)
return "";
if((okMaterials()!=null)&&(okMaterials().length>0))
{
for(int m=0;m<okMaterials().length;m++)
{
if((R.myResource()&RawMaterial.MATERIAL_MASK)==okMaterials()[m])
return L("You sense @x1 here.", RawMaterial.CODES.NAME(R.myResource())... | 9 |
private float calculAngle(float x, float y, float xCursor, float yCursor) {
float a = xCursor - x, b = yCursor - y;
float mod = (float) Math.sqrt(a*a + b*b);
double angleRadian = Math.acos(a / mod);
if (a == 0) {
if (b > 0) angleRadian = 3 * Math.PI / 2;
else if (... | 7 |
public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) {
Class<?> rawType = type.getRawType();
final boolean skipSerialize = excludeClass(rawType, true);
final boolean skipDeserialize = excludeClass(rawType, false);
if (!skipSerialize && !skipDeserialize) {
return null;
}
... | 6 |
private void startProcessDistribute(){
while(noStopRequested){
try{
workers.take().processResponse(this.readPool.take());
}catch(Exception e){
e.printStackTrace();
}
}
} | 2 |
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
if(evt.getButton() == 1){
jTextField2.setEnabled(true);
jTextArea1.setEnabled(true);
jTextArea2.setEnabled(true);
jTextArea3.setEnabled(true);
... | 7 |
public static void DFSTest(WUGraph g, WUGraph t, DFSVertex[] vertArray) {
int[][] maxOnPath;
Neighbors neigh;
int i, j;
System.out.println("Testing the tree.");
maxOnPath = new int[VERTICES][VERTICES];
for (i = 0; i < VERTICES; i++) {
for (j = 0; j < VERTICES; j++) {
vertArray[j]... | 9 |
@Override
int makeTurn()
{
System.out.print("You choose: ");
int number;
do
{
number = in.nextInt();
} while(number < Game.MIN_CHOICE || number > Game.MAX_CHOICE);
return number;
} | 2 |
public void setImgPath_UserlistImage(Path img, Imagetype type) {
switch (type) {
case MOUSEFOCUS:
this.imgUserlist_MFoc = handleImage(img, UIResNumbers.USERLIST_IMAGEFRAME_MFOC.getNum());
if (this.imgUserlist_MFoc == null) {
this.imgUserlist_MFoc =... | 8 |
public static void main(String[] args) {
ConsistentGlobalProblemSetInitialisation starter = new ConsistentGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolut... | 8 |
private String msgchk(String chk, String msg) throws InterruptedException, FileNotFoundException, UnsupportedEncodingException{
String broken[];
if (chk.endsWith(ghosts)){
ghost=1;
}
if (chk.endsWith(nonstop)){
if (cnt == 0){
dataOut.print("n\... | 8 |
public static boolean objIsSitting(int objId) {
synchronized (glob.oc) {
for (Gob gob : glob.oc) {
if (gob.id == objId) {
Layered lay = gob.getattr(Layered.class);
if (lay != null) {
for (Entry<Indir<Resource>, Sprite> s... | 5 |
@SuppressWarnings("unchecked")
public static void extractZIP(LauncherAPI api, GameFile source, File file,
File dest, int min, int max) throws Exception
{
final ZipFile zip = new ZipFile(file);
Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zip.entries();
... | 5 |
private void setCalorimetery(String s ) throws Exception
{
String[] splits = s.split("\t");
if( splits.length != 3)
throw new Exception("No " + splits);
if( splits[1].equals("1") && this.calorimetryData1 != null)
throw new Exception("No");
if( splits[1].equals("2") && this.calorimetryData2 != nu... | 7 |
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuilder sb = new StringBuilder();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i ... | 6 |
public int getMinRecur(int front, int rear){
//base case
if(front == rear||rear-front==1)
{
if(arr[front] > arr[rear]){
System.out.println("min: "+arr[rear]);
}else{
System.out.println("min: "+arr[front]);
}
return -1;
}
int middle = (rear+front)/2;
if(arr[front] > arr[middle... | 4 |
private List<IntKeyValuePair> getKVPs() {
List<IntKeyValuePair> kvpArray = new ArrayList<IntKeyValuePair>();
for(int i = 0; i < size; i++) {
kvpArray.addAll(map[i].getKeyValuePairs());
}
Collections.sort(kvpArray);
return kvpArray;
} | 1 |
public Constraint usingValidator(final GeneralValidator validator) throws IllegalArgumentException,
IllegalStateException {
validator.validate(this.paramValue, this.value);
return new Constraint(this);
} | 0 |
public void promotionClicked(int y) {
if (!selectingPromotion) return;
y-=100;
y /= 50;
if (y == 0) {
promotionPiece = new Queen(promotionColor);
} else if (y == 1) {
promotionPiece = new Bishop(promotionColor);
} else if (y == 2) {
pr... | 5 |
private void toForester( final Writer writer ) throws IOException {
final int longest = getLengthOfLongestState() + 5;
writer.write( "Identifiers: " );
writer.write( String.valueOf( getNumberOfIdentifiers() ) );
writer.write( ForesterUtil.LINE_SEPARATOR );
writer.write( "Characte... | 9 |
public Card dealCard() {
numCards = deckCount * 52;
if (dealt >= numCards) {
throw new IllegalStateException("No Cards Left In The Deck");
} else {
cardsRemaining = numCards - dealt;
switch (cardsRemaining) {
case 15:
System.out.println("15 cards remaining in the shoe");
break;
case 5:
... | 6 |
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter)
{
try
{
String line = value.toString(); //got one event information with first field as: Venue_ID
BufferedReader inCandidateFile = new BufferedReader(new FileReader(localPath[1].toString()));... | 9 |
@Override
public int compareTo(Object o) {
try{
Pair p = (Pair)o;
//if(p.first == this.first && p.second == this.second)
if(p.first.equals(this.first) && p.second.equals(this.second))
return 0;
}catch(ClassCastException e)
{
/... | 3 |
@Override
public void draw(Graphics2D g2) {
g2.drawImage(background, 0, 0, GamePanel.WIDTH, GamePanel.HEIGHT, null);
for (int i = 0; i < items; i++) {
Rectangle rect = new Rectangle((GamePanel.WIDTH / 2) - (90 / 2), (GamePanel.HEIGHT / 2) + (20 + i * 50), 90, 46);
if (i == selectedItem) {
g2.drawImage(b... | 3 |
private int[][] fillHeight(int[][] map)
{
int length = map.length / 2;
//fill center tile
map[(map.length - 1) / 2][(map[0].length - 1) / 2] = (map[0][0] + map[0][map[0].length - 1] + map[map.length - 1][0] + map[map.length - 1][map[0].length - 1]) / 4 + random();
while (length > 0)
{
//do diam... | 7 |
@Test
public void testRegistreerGebruiker() throws Exception {
File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/RegistreerGebruikerTest.csv");
if (f.exists() && f.isFile()) {
String naam;
String wachtwoord;
String wachtwoord2;
String adres;
String postcode;
String woonplaats;... | 4 |
public boolean isRead() {
/* if it is part of a += operator, this is a read. */
return parent != null && parent.getOperatorIndex() != ASSIGN_OP;
} | 1 |
public void gfxPlayRound(int myXCoor, int myYCoor, int targXCoor, int targYCoor) {
previousBoard = DeltaBoard.cloneBoard(board);
// Checks if user's king is in check before moving
if (isChecked(userColor, getXOfKing(userColor), getYOfKing(userColor), true)){ // Check whether the user's king is i... | 7 |
private void initPanel(){
panel.setBackground(Color.black);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(Box.createRigidArea(new Dimension(30, 50)));
panel.add(label);
panel.add(Box.createRigidArea(new Dimension(30, 50)));
panel.addKeyListener(new Ke... | 5 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int quizID = Integer.parseInt(request.getParameter("quizID"));
HttpSession session = request.getSession();
int position = 0;
Quiz quiz = Quiz.getQuizByQuizID(quizID);
session.setAttribute("is... | 7 |
public Row getLastSelectedRow() {
int index = getLastSelectedRowIndex();
return index == -1 ? null : getRowAtIndex(index);
} | 1 |
public ListNode partition(ListNode head, int x) {
if (head == null) return head;
if (head.val < x) {
head.next = partition(head.next, x);
return head;
}
ListNode p = head.next, q = head;;
while (p!=null && p.val >= x) {
q = q.next;
p =p.next;
}
if (p == null) return head... | 5 |
private boolean readNumber( boolean fireEvent, StringBuffer b )
throws IOException,
JSONSyntaxException {
// Detect any sequence of digits
while( this.readChar() && this.isDigit(this.currentChar) )
b.append( this.currentChar );
// Floating point following?
if( this.currentChar == '.' ) {
b.... | 4 |
@SuppressWarnings("unchecked")
public static void printList(AbstractList list, int depth)
{
final Iterator i = list.iterator();
Object o = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("List: ");
while (i.hasNext() && (o = i.nex... | 4 |
List<String> events(Subscribe subscriber) {
final String event2 = subscriber.value();
String[] eventz = subscriber.events();
List<String> events = new ArrayList<String>();
if (event2 != null && !event2.isEmpty()) {
events.add(event2);
}
for (String e : eventz) {
if (e != null && !e.... | 5 |
private static double getGreatestDistance(JadeNode inNode) {
double distance = 0.0;
if (inNode.isInternal()) {
if (inNode.isTheRoot()) {
distance = inNode.getBL();
}
double posmax = 0.0;
for (int i = 0; i < inNode.getChildCount(); i++) {
double posmax2 = getGreatestDistance(inNode.getChild(i));
... | 4 |
private void createMap() {
Node node;
map = new ArrayList<ArrayList<Node>>();
for (int x = 0; x < mapWith; x++) {
map.add(new ArrayList<Node>());
for (int y = 0; y < mapHeight; y++) {
node = new Node(x, y);
if (obstacleMap[x][y] == 1) {
node.setObstical(true);
}
map.get(x).add(node);
... | 3 |
public void loadLegendConfig() throws FileNotFoundException,
BadConfigFormatException {
cellTypes = new HashMap<Character, String>();
FileReader reader = new FileReader(legend);
Scanner s = new Scanner(reader);
String infoString;
char abbreviation;
String cellName;
while (s.hasNextLine()) {
// grab l... | 2 |
public int getPage() {
return page;
} | 0 |
private void buildAddress()
{
FileReader inetSaves = null;
int numAdd = 0;
numAddress=0;
try
{
byteCount = (new File("IPAddressBank.rcf")).length();
byteCount = (long) 1.25*byteCount;
inetSaves = new FileReader("IPAddressBank.rcf");
//Check the file header
if(!readTill(';',inetSaves).equals(... | 5 |
public AbstractPlay get(int number) {
return super.get(number);
} | 0 |
public static void main(String[] args){
long t = 1;
long p = 1;
long h = 1;
long T=2, P=3, H=4;
boolean firstTime=true;
while(true){
if (T<= P && T<=H){
t++;
T=t*(t+1)/2;
} else if (P <= T && P <= H){
p++;
P=p*(3*p-1)/2;
} else {
h++;
H=h*(2*h-1);
}
if (T == P && P == ... | 8 |
public void insert(MazeCell item, MazeCell current){
int j;
if(item == null) System.out.println("PROBLEEEEEEEEEM");
if(rear == maxSize-1){ // deal with wraparound
rear = -1;
//System.out.println("PROBLEEEEEEEEEM2");
}
if (nItems==0){
queArray[++rear]= item;
... | 5 |
protected Object readObjectImpl(Class cl)
throws IOException
{
try {
Object obj = cl.newInstance();
if (_refs == null)
_refs = new ArrayList();
_refs.add(obj);
HashMap fieldMap = getFieldMap(cl);
int code = read();
for (; code >= 0 && code != 'z'; code = read()) ... | 8 |
SortGraphics(){
JFrame frame = new JFrame("Sorting Algorithms");
canvas.setForeground(Color.black);
canvas.setBackground(Color.white);
Sort.setPointNumber(300); // calls init
frame.getContentPane().add(canvas);
frame.getContentPane().validate();
frame.setDefaultCloseOperation(JFrame.EXIT_ON... | 6 |
public void keyReleased(KeyEvent e) {
switch(e.getKeyCode()) {
case 37: left = false;
leftReleased = true;
break;
case 39: right = false;
rightReleased = true;
break;
case 65: a = false;
aReleased = true;
break;
case 68: d = false;
dReleased = true;
break;
case 10: enter = false;
ente... | 9 |
private BeanstreamApiException mappedException(int status, BeanstreamResponse bsRes) {
if (bsRes != null) {
return BeanstreamApiException.getMappedException(status, bsRes);
}
return BeanstreamApiException.getMappedException(status);
} | 1 |
public Token scanForNextToken()
{
if (!matcher.find())
return null;
String tokenstring = matcher.group();
String type = null;
if (Pattern.compile(SPECIAL_SYMBOL).matcher(tokenstring).matches())
type = "specialsymbol";
else if (Pattern.compile(KEYWORD).matcher(tokenstring).matches())
type = "keyword... | 9 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder("");
for (int x=size-1; x >= 0; x--) {
for (int y=0; y < size; y++) {
switch (grid[x][y]) {
case UNSAFE:
sb.append(" X ");
break;
case OCCUPIED:
sb.append(" Q ");
break;
case EMPTY:
sb.append(" _ "... | 5 |
public RTT.corba.CSendHandle sendOperation (String operation, org.omg.CORBA.Any[] args) throws RTT.corba.CNoSuchNameException, RTT.corba.CWrongNumbArgException, RTT.corba.CWrongTypeArgException, RTT.corba.CCallInterrupted
{
org.omg.CORBA.portable.InputStream $in = null;
try {
o... | 6 |
@Override
public void run()
{
int frames = 0;
double unprocessedSeconds = 0;
long lastTime = System.nanoTime();
double secondsPerTick = 1 / 60.0;
int tickCount = 0;
requestFocus();
while (running)
{
long now = System.nanoTime();
long passedTime = now - lastTime;
lastTime = now;
if (pass... | 7 |
public String getMsgID() {
return msgID;
} | 0 |
int at(long x){
long L=0, R=0;
int k;
for(k=17;k>=0;k--)if(endK[k] < x){
L = ten[k];
R = k==17?MAX_NUMBER:ten[k+1];
break;
}
for(;;){
long m = (R+L)/2;
long p = endK[k]+1+(k+1)*(m-ten[k]);
if(p<=x&&x<p+k+1){
String s = m+"";
for(int i=0;i<s.length();i++)if(p+i==x)return s.charAt(i)-'... | 9 |
@Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In road building handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
//TODO verify cookie method
String unvalidatedCookie = exchange.getRequestHe... | 4 |
public boolean test() {
FileSystem fs;
try {
fs = new FileSystem("sample");
} catch (Exception e) {
return false;
}
System.out.println(fs.toXMLString());
// make sure 'sample/foo/bar' is in the file system
Tree<FileNode> rt = fs.getTree();
if(!rt.getLabel().getName().equals("CWD"))
return fals... | 6 |
public boolean hasPrefix(PGridPath path) {
if (path == null) {
throw new NullPointerException();
}
return commonPrefix(path).length() == path.length();
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestClass other = (TestClass) obj;
if (component == null) {
if (other.component != null)
return false;
} else if (!component.equals(othe... | 7 |
private void getCategoryContent(Map<String, Object> jsonrpc2Params) throws Exception {
Map<String, Object> params = getParams(jsonrpc2Params,
Constants.Param.Name.CATEGORY_ID,
Constants.Param.Name.TYPE);
int categoryId = (Integer) params.get(Constants.Param.Name.CATEGOR... | 4 |
@Override
public boolean decrementLives() {
if (lives == -1)
return true;
if (lives > 0) {
lives--;
return true;
}
return false;
} | 2 |
public long fillTables() {
Iterator it = tables.listIterator(); // list of relevant source-tables
String srctable=""; // holds name of current source-table
long rowcount = 0;
// add the database identifier into the SELECT statement
queryStr = queryStr.replaceAll("databaseID... | 9 |
public void run() {
try {
if (isListener) {
connection = listener.accept();
writeBuffer = new QueueBuffer<String>(connection.getOutputStream());
readBuffer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
handler.setState(State.CONNECTED);
}
while (true) {
S... | 5 |
public void visit_ldiv(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} | 1 |
public JTextField getjTextFieldPrenom() {
return jTextFieldPrenom;
} | 0 |
public String getContents() {
return buffer.toString();
} | 0 |
public final String toString() {
StringBuffer sb = new StringBuffer();
sb.append("{ " + super.toString());
sb.append(", distance=" + distance);
sb.append(", position=(" + position.getX() + "," + position.getY()
+ ")");
sb.append(", lineWidth=" + lineWidth);
sb.append(", incrementWidth=" + incrementWidth... | 0 |
public static byte[] getInverterType(String code) {
byte[] invertercode = new byte[4];
if (code.equals("1700TL")) {
invertercode[0] = 0x12;
invertercode[1] = 0x1a;
invertercode[2] = (byte) 0xd9;
invertercode[3] = 0x38;
//conf->ArchiveCode = ... | 9 |
public BitVector subset(int start, int end) {
if (start < 0 || end > size() || end < start)
throw new IndexOutOfBoundsException();
// Special case -- return empty vector is start == end
if (end == start) return new BitVector(0);
byte[] bits = new byte[((end - start - 1) >>> 3) + 1];
int s = st... | 6 |
@Override
public ResultSet fillData(String command) {
try {
if (connection.isClosed())
Connect(server);
} catch (SQLException e) {
Connect(server);
}
try {
return connection.prepareStatement(command).executeQuery();
} catch (SQLException e) {
e.printStackTrace();
return null;
}
} | 3 |
public void checkDatabaseConnection() {
logger.info("Checking database connection...");
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
try {
jdbcTemplate.queryForInt(SqlQueries.CHECK_DATABASE_QUERY);
logger.info("Database is up!");
} catch (DataAccess... | 1 |
public static void main(String[] args){
int average = 141;
System.out.println(average);
int invert=0;
int help = average;
while (help !=0) {
invert=invert*10+help%10;
help=help/10;
}
System.out.println(invert);
if (average == invert) {
System.out.println("it is a palindrome");
}
else ... | 2 |
protected void printFileHeader(PrintWriter writer) {
writeToFile(HEADER_TIME, false);
int nrOfClusters = clusters.size();
for (int i = 0; i < nrOfClusters; i++) {
int nrOfElementsInCluster = clusters.get(i).getTimeSeriesIndexes().size();
for (int j = 0; j < nrOfElementsInCluster; j++) {
if (is... | 3 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.