text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void negate() {
boolean doneZeros = false;
boolean doneFirst = false;
for (int i = digits.size() - 1; i >= 0; i--) {
if ((digits.get(i)) > 0) {
doneZeros = true;
}
if (!doneFirst && doneZeros) {
int temp = 10 - digits.get(i);
digits.set(i, temp);
// System.out.println("made it");
... | 6 |
private boolean sendHandshake(Socket socket, byte[] remotePeerId, boolean obfuscate) throws IOException {
OutputStream os = socket.getOutputStream();
Handshake hs = Handshake.craft(this.torrent.getInfoHash(),this.id, remotePeerId, obfuscate);
os.write(hs.getBytes());
logger.debug("Send Handshake to " + this.so... | 0 |
public List<RefactoringSuggestion> call(String[] args) {
Options options = new Options();
options.addOption("cceor", true, "Consolidate Conditional Expression Or");
options.addOption("cceand", true, "Consolidate Conditional Expression And");
options.addOption("cdcf", false,
"Consolidate Duplica... | 9 |
public static String colorize(String in) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < in.length(); i++) {
if (in.charAt(i) == '&' && i < in.length() - 1) {
char ctrl = in.charAt(i + 1);
ChatColor cc = ChatColor.getByChar(ctrl);
if (cc != null) {
sb.append(cc);
i++;
} el... | 5 |
@Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||life--<0)
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
if (!apples.isSolid(X, Y-10))
{
Y-=10;
}
for (int i = 1; i < 10; i++)
{
if (... | 9 |
private <T extends Comparable> boolean search(T value, BinaryTree root) {
boolean result = false;
if (root == null) {
result = false;
} else {
if (value == root.getValue())
result = true;
else {
if (value.compareTo(root.getValue()) < 0) {
result = search(value, root.left);
} else {
... | 3 |
private boolean noCopy() {
Iterator<Point> it = pointIterator();
while(it.hasNext()) {
Point a = it.next();
int count = 0;
Iterator<Point> et = pointIterator();
while(et.hasNext()) {
Point b = et.next();
if (a.x == b.x && a.y == b.y) ++count;
}
if (count != 1) return false;
}
retur... | 5 |
protected void slice_check()
{
if (bra < 0 ||
bra > ket ||
ket > limit ||
limit > current.length()) // this line could be removed
{
System.err.println("faulty slice operation");
// FIXME: report error somehow.
/*
fprintf(stderr, "faulty slice operation:\n");
debug(z, -1, 0);
... | 4 |
public final void setFrame()
{
try
{
if (icons.size() == 0)
icons.add(ImageIO.read(Frame.class.getResource("/logo.png")));
}
catch (IOException e)
{
System.out.println("LOGO not located");
}
addComponentListener(TCode.input);
if (TCode.frameWidth == 0)
TC... | 5 |
public List<Row> getChildren() {
return canHaveChildren() ? Collections.unmodifiableList(mChildren) : null;
} | 1 |
public void sendUpdates() {
if(connection.isClosed()) {
System.out.println("Why are you updating a closed socket?");
return;
}
try {
//write each queued event to output
while(queuedEvents.size()>0) {
UpdateEvent event = queuedEvents.poll();
if(event!=null){
event.writeTo(connection.getOut... | 4 |
public IntegerWrapper integerUpperBound() {
{ IntervalCache interval = this;
{ Stella_Object ub = interval.upperBound;
if (ub != null) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(ub);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrappe... | 6 |
public static void main(String[] args) {
double d = 257.234;
int i = (int) d;
System.out.println(i); // 257
byte b = (byte) d;
System.out.println(b); // 1 (257%256)
} | 0 |
@Override
public void onUpstreamMessageEvent(ChannelMessageEvent event,
PipelineHandlerContext context)
throws Exception
{
if( !(event.getMessage() instanceof IOBuffer) || errorState )
{
context.sendUpstream(event);
return;
}
IOBuffer buffer = (IOBuffer) event.getMessage();
bufferC... | 7 |
private static Case directionOptimaleEchappee(Grille grille, Case caseMission) {
Monstre monstres = grille.getNbVampires(caseMission) != 0 ? Monstre.VAMPIRES : Monstre.LOUPS;
ArrayList<Case> toutesCasesAdjacentes = grille.getToutesCasesAdjacentes(caseMission);
ArrayList<Case> casesDisponibles = ... | 8 |
public List findByActive(Object active) {
return findByProperty(ACTIVE, active);
} | 0 |
public void setInstances(Instances inst) {
m_Instances = inst;
String [] attribNames = new String [m_Instances.numAttributes()];
for (int i = 0; i < attribNames.length; i++) {
String type = "";
switch (m_Instances.attribute(i).type()) {
case Attribute.NOMINAL:
type = "(Nom) ";
break;
... | 8 |
public static String possibleQueenMoves(int i) {
String list="", oldPiece;
int r=i/8, c=i%8;
int temp=1;
for (int j=-1; j<=1; j++)
{
for (int k=-1; k<=1; k++)
{
if(j!=0 || k!=0)
{
try {
w... | 9 |
private static List<Integer> generate() {
List<Integer> list = new LinkedList<Integer>();
for (int i = 0; i < 10; i++) {
int num = new Random().nextInt(100);
list.add(num);
}
Collections.shuffle(list);
return Collections.unmodifiableList(list);
} | 1 |
public SetModeRainbowDanceParty(){
super(colors,1.0/20);
} | 0 |
private void getCountryCollection(AbstractDao dao, List<Direction> directions) throws DaoException {
for (Direction dir : directions) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_DIRECTION, dir.getIdDirection());
List<LinkDirectionCountry> links = dao.findLinkDirect... | 1 |
public void activate(){
activated = true; //set activated
boolean allActive; //have all the parents been activated?
time = 0;
//find the longest time from parents (critical time)
for(Connection g:input){
if(time < g.getParent().time)
time = g.getParent().time;
}
//add current gate's propagation d... | 6 |
private void initBlocks(){
blocks.clear();
blocks.add(new Block(180,120,16,16));
blocks.add(new Block(50,120,16,16));
blocks.add(new Block(88,160,16,16));
blocks.add(new Block(88+16,160,16,16));
blocks.add(new Block(88+32,160,16,16));
int y=208;
for(int i=... | 7 |
public void deregister(final Region region) {
this.regions.remove(region);
this.references.remove(region);
this.catalog.deregisterOptions(region);
// unload region from any loaded chunk index entries
final Iterator<Entry<Long, Set<Region>>> it = this.cache.entrySet().iterator();... | 3 |
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpObject obj) throws Exception {
if (obj instanceof HttpRequest) {
HttpRequest req = (HttpRequest) obj;
if (shouldBlock(req)) {
logger.info("Blocking black-listed request: " + req.getUri());
... | 5 |
private void tick() {
if (index == 4) {
System.exit(ERROR);
}
menus.get(index).tick();
for (int i = 0; i < timers.size(); i++) {
timers.get(i).tick();
}
for (Animation a : anims) {
a.tick();
}
} | 3 |
public int getEdgeNumber(){
int counter = 0;
for(int i = 0; i < number; i++){
for(int j = 0; j < number; j++){
if(matrix[i][j] == 1){
counter++;
}
}
}
return counter / 2;
} | 3 |
private void addInteraction(ThreatClass threatClass,
AbstractInsnNode abstractInsnNode) {
AbstractInsnNode previousNode = abstractInsnNode.getPrevious();
if (previousNode instanceof VarInsnNode) {
int var = ((VarInsnNode) previousNode).var;
previousNode = previousNode.getPrevious();
while (previousNode ... | 7 |
private boolean checkAuthURL(String action, String... params) {
// if there isn't at least one parameter OR
// if params length is not an even number
if (params.length < 2 || ((params.length % 2) != 0))
return false;
try {
//HttpURLConnection.setFollowRedirects(false);
HttpURLConnection ... | 6 |
public static String extractChars(String s) {
if (s == null) {
return StringPool.BLANK;
}
StringBuilder sb = new StringBuilder();
char[] c = s.toCharArray();
for (int i = 0; i < c.length; i++) {
if (Validator.isChar(c[i])) {
sb.append(c[i]);
}
}
return sb.toString();
} | 3 |
protected Map<String, Object> postProcessCellStyle(Map<String, Object> style)
{
if (style != null)
{
String key = mxUtils.getString(style, mxConstants.STYLE_IMAGE);
String image = getImageFromBundles(key);
if (image != null)
{
style.put(mxConstants.STYLE_IMAGE, image);
}
else
{
image ... | 5 |
public List<Vector3f> getHotSpotsFor(String key){
List<Vector3f> modelHotSpots = getModel().getHotSpotFor(key);
List<Vector3f> transformedSpots = new ArrayList<Vector3f>();
Matrix4f transform = getTransformInverse();
if(modelHotSpots != null)
for(Vector3f vec : modelHotSpots)... | 2 |
private static boolean closeFrames(boolean significant) {
for (Frame frame : Frame.getFrames()) {
if (frame instanceof SignificantFrame == significant && frame.isShowing()) {
try {
if (!CloseCommand.close(frame)) {
return false;
}
} catch (Exception exception) {
Log.error(exception);
... | 5 |
public Position getNextPos(Node n){
Map map = Tools.getBackgroundMap();
Position newPos = new Position();
boolean inLake = false;
if(Configuration.useMap){
inLake = !map.isWhite(n.getPosition()); //we are already standing in the lake
}
if(inLake){
Main.fatalError("A node is standing in a lak... | 5 |
public int getIdByData(String name, String shortDescription, String version,
LanguageTypeEnum language){
int result = -1;
try {
PreparedStatement statement = connection.prepareStatement(GET_ID_BY_DATA);
statement.setString(1, name);
statement.setString(2, shortDescription);
statement.setString(3,... | 3 |
public byte[] process(byte[] srcBytes, boolean encrypt) {
try {
Cipher cipher = Cipher.getInstance("DES");
cipher.init(encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, key);
return cipher.doFinal(srcBytes);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
} | 2 |
private static void addStartButtonListener(JButton Start){
// <editor-fold defaultstate="collapsed" desc="MBO Start Button">
Start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
fromMBO = true;
... | 3 |
@Override
public List<Player> selectPlayerOfMatchByDayHour(int heure, int day) throws SQLException, IOException {
connexionDB = ConnexionMysqlFactory.getInstance();
ResultSet rs = null;
List<Player> lp = new ArrayList<>();
Statement st = connexionDB.createStatement();
try (Pr... | 4 |
public static void main(String[] args) {
System.out.println("Enter # of Rows");
int rows = in.nextInt();
for (int column = 1; column <= rows; column++) {
for (int row = 1; row <= column; row++) {
if (row == 1 && column == 1) {
for (int i = 1; i <= rows; i++) {
System.out.print(decFormat.format(i... | 6 |
public boolean existWhiteForest(){
for(int i=0;i<getDim();i++)
for(int j=0;j<getDim();j++)
if(!damiera[i][j].isFree() && damiera[i][j].getPezzo().getColore()==Color.WHITE)
if(!damiera[i][j].getPezzo().getAlberoMosse().isSAMNull())
return true;
return false;
} | 5 |
public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... | 8 |
public void setFullScreen(JFrame w, DisplayMode dm) {
w.dispose();
w.setUndecorated(true);
//display mode support
if (vc.isDisplayChangeSupported()) {
try {
vc.setDisplayMode(dm);
} catch (Exception ex) {
vc.setDisplayMode(vc.getD... | 3 |
public Snake(Vector2f head, int length, int direction, ReadableColor color) {
this.initialSnake = new ArrayList<Vector2f>();
for (int i = 0; i < length; i++) {
if (direction == 0) initialSnake.add(initialSnake.size(), new Vector2f(head.x - i, head.y));
else if (direction == 1) in... | 5 |
public static long unsortedExperiment(){
startTime = (new Date()).getTime();
int choice;
Long number;
for(int i = 0; i < NUMBER_OF_CHOICES; i++)
{
choice = choices[i];
number = numbers[choice];
if(!linearSearch(number))
{
System.out.println("Not found");
break;
}
else if... | 3 |
private boolean gatherKeyPointers(){
String keys;
try{
keys = fileToString(pointerStorage);
}
catch (RuntimeException e){
System.out.println("Can't read pointer storage, perhaps it's empty");
return false;
}
String key = "";
St... | 5 |
@OneToMany(mappedBy="event1")
public List<Car> getCars() {
return cars;
} | 0 |
public int getNumber(String colors)
{
if (colors.length() == 0)
return 0;
int result = 1;
int i = 0;
while (i < colors.length()) {
int max = 1;
i++;
while ((i < colors.length()) && (colors.charAt(i) == colors.charAt(i - 1)) ) {
i++;
max++;
}
if (max > result)
result = max;
}
r... | 5 |
@Override
public void run() {
// First time through the while loop we do the merge
// that we were started with:
MergePolicy.OneMerge merge = this.startMerge;
try {
if (verbose())
message(" merge thread: start");
while(true) {
setRunningMe... | 8 |
public Stardata Fk425(Stardata s1950) {
double r, d, ur, ud, px, rv, sr, cr, sd, cd, w, wd, x, y, z, xd, yd, zd, rxysq, rxyzsq, rxy, rxyz, spxy, spxyz;
int i, j;
/* Star position and velocity vectors */
double r0[] = new double[3], rd0[] = new double[3];
/* Combined position an... | 8 |
public static void main(String args[]) {
if (args.length > 0) {
if(args[0].length() <= 8 )
{
if (isNum(args[0])) {
Conver cv = new Conver();
cv.converStart(args[0]);
} else {
System.out.println("用户输入的字符不都为数,无法转换 !");
}
}
else
{
System.out.println("请输入八... | 3 |
void print(){
int i=s.length;
int j=t.length;
int newi = i-1;
int newj = j-1;
for(int k=ed;k>=0;k--){
if(i-1>=0)
newi = i-1;
else
newi=i;
if(j-1>=0)
newj = j-1;
else
newj = j;
if((j-1)>=0 && m[i][j-1]<m[newi][newj]){
newj = j-1;
}
if((i-1)>=0 && m[i-1][j]<m[new... | 7 |
@Override
public void process(SimEvent event) {
NodeReachedEvent _event = (NodeReachedEvent) event; // Casts the event.
//int _oldPosition = getPosition(); // Saves the old position (Where the agent came from).
setPosition(_event.getPosition()); // Sets the actual position to the reached node.
System.out.prin... | 2 |
public synchronized void move(){
//choose the direction
Location temp = new Location(loc.getX(), loc.getY());
this.chooseDirection();
//makes and checks temporary location
switch(dir){
case 'L':
temp.setX(temp.getX() - 1);
break;
case 'R':
temp.setX(temp.getX() + 1);
break;
... | 7 |
public static Sequence loadMidi(String fileName)
{
Sequence sequence = null;
try
{
sequence = MidiSystem.getSequence(new File("./res/midi/" + fileName));
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
return sequence;
} | 1 |
private void setupAccessibility() {
getAccessibleContext().setAccessibleDescription("Application for learning the CECIL machine language (English). Press ALT to tab between the menu bar and the main application.");
menuBar.getAccessibleContext().setAccessibleName("Menu bar");
menuBar.getAccessibleContext().set... | 4 |
public Iterator<MedicineXmlTO> read() throws InterruptedException{
ArrayList<MedicineXmlTO> medTo = new ArrayList<MedicineXmlTO>();
try {
Connection connection = DbPool.getInstance().getConnection();
Statement st = connection.createStatement();
ResultSet rs = st.execu... | 5 |
protected void mapChildrenValues(Map<String, Object> output, ConfigurationSection section, boolean deep) {
if (section instanceof MemorySection) {
MemorySection sec = (MemorySection) section;
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
output.put(createP... | 5 |
public void run() {
Server server = Bukkit.getServer();
ChatColor purple = ChatColor.DARK_PURPLE;
Plugin larvikGaming = server.getPluginManager().getPlugin("LarvikGaming");
int delay = larvikGaming.getConfig().getInt("RestartTimeInHours", 6) * 3600000;
if (delay < 1) {
return;
}
try {
Th... | 8 |
static final void method1935(int i, int i_10_, Class30 class30,
AnimatableToolkit class64, boolean bool, int i_11_) {
try {
anInt3270++;
if (class64 != null) {
if (bool != false)
method1929((byte) 106);
class30.method320(class64.EA(), class64.fa(), (byte) -4, i_11_,
class64.na(), i, clas... | 5 |
@AfterTest
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
} | 1 |
public int countBins(){
return this.bins.size();
} | 0 |
public static String[] getParagraphs(String article ){
String[] ret=null;
try {
int pFromIndex=0;
int pToIndex=0;
ArrayList<Integer> startPIndexs=new ArrayList<Integer>();
ArrayList<Integer> endPIndexs=new ArrayList<Integer>();
while(-1!= article.indexOf("<P>", pFromIndex)){
int t = ar... | 5 |
public static void main(String[] args) {
try {
svm_model svmModel = svm.svm_load_model("SvmModel.eye");
FaceFeaturesFinder faceFeaturesFinder = new FaceFeaturesFinder(svmModel);
if (args.length != 1) {
throw new IOException("invalid images path");
}
String imagesPath=args[0] ;
File file... | 7 |
public int numberOfPersonsWhoOrderedTheSameMeal(){
int i = 0;
int timesTheSameMealIsOrdered = 0;
for(Command command: this.commands){
if(command.compareCommandTo(commands.get(i))==-1){
if(command.orderTheSameMeal(command)==1){
timesTheSameMealIsOrdered++;
}
}
i++;
}
return timesTheSameMe... | 3 |
@Override
public String dismountString(Rider R)
{
switch(rideBasis)
{
case Rideable.RIDEABLE_AIR:
case Rideable.RIDEABLE_LAND:
case Rideable.RIDEABLE_WATER:
return "disembark(s) from";
case Rideable.RIDEABLE_TABLE:
case Rideable.RIDEABLE_SIT:
case Rideable.RIDEABLE_SLEEP:
case Rideable.RIDEABLE_W... | 9 |
public Worker[] list () {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Worker> workers = new ArrayList<Worker>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT * FROM workers WHERE status != 'terminated'";
stateme... | 8 |
public static GameState readCSV(String filename){
int superzahl = 0;
CSVReader reader = null;
try {
reader = new CSVReader(new FileReader(filename), ';');
}
catch (IOException e){
System.out.println(e.toString());
}
String [] nextLine;
ArrayList<int[]> parsedList = new ArrayList<int[]>();
try {... | 8 |
public Investment getChild(int id) {
for (Investment i : this.children) {
if (i instanceof Bond) {
if (i.getUniqueId() == id) return i;
}
else if (i instanceof Stock) {
if (i.getUniqueId() == id) return i;
}
else if (i instanceof MoneyMarket) {
if (i.getUniqueId() == id) return... | 8 |
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av = mv.visitAnnotation(remapper.mapDesc(desc),
visible);
return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
} | 1 |
public void setIdentificador(TIdentificador node)
{
if(this._identificador_ != null)
{
this._identificador_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
... | 3 |
private String getNewTheoryInList() {
StringBuffer theories = new StringBuffer( );
for(int i=0;i<theoriesSplittedsRead.length;i++){
if(theoriesSplittedsRead[i].contains("THEORY User_Pass IS"))
continue;
if(i+1 != theoriesSplittedsRead.length) //if space after the last end
theories.append(the... | 7 |
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void visitMethod(ClassNode c, MethodNode m) {
FlowGraph fg = m.graph();
for(Iterator it = new HashSet(fg.handlersMap().entrySet()).iterator(); it.hasNext();) {
Map.Entry<Block, Handler> handlerEntry = (Entry<Block, Handler>) it.next();
Hand... | 3 |
private void DeleteInstanceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteInstanceButtonActionPerformed
if (!InstanceComboBox.getSelectedItem().toString().equals("<None>")) {
String instanceToBeRemoved = InstanceComboBox.getSelectedItem().toString();
... | 4 |
public void GAstep_selection() {
/* провести селекцию*/
/**
* все сложить в одну кучу отсортировать по фитнесу удалить все лишние
*/
Map<Integer, Species> typeByOrganism = new HashMap<Integer, Species>();
List<Organism> allOrganisms = new ArrayList<Organism>();
... | 6 |
public byte[] getByteArray(String key) {
try {
if(hasKey(key))
return ((NBTReturnable<byte[]>) get(key)).getValue();
return new byte[]{};
} catch (ClassCastException e) {
return new byte[]{};
}
} | 2 |
public DDALine(Excel ex1, Excel ex2)
{
begin = ex1;
end = ex2;
this.setColoredExes();
} | 0 |
private boolean jj_3R_70() {
if (jj_scan_token(LEFTBRACKET)) return true;
if (jj_3R_61()) return true;
if (jj_scan_token(RIGHTBRACKET)) return true;
return false;
} | 3 |
private void showAddItemWizard() {
System.out.println("\n---------------------------------------");
System.out.println("- New item wizard - Step 1 -");
System.out.println("---------------------------------------");
System.out.println("Please select an option :");
Syste... | 4 |
@Test
public void testKlusToevoegen() throws Exception {
File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/KlusToevoegenTest.csv");
if (f.exists() && f.isFile()) {
String klusnaam;
String klusomschrijving;
String datumdag;
String datummaand;
String datumjaar;
FileReader fr = n... | 4 |
@Override
public Vector4D multiply(MatrixS4 matrix) {
double[] result = new double[4];
double suma;
try {
for (int i = 0; i < 4; i++) {
suma = 0;
for (int j = 0; j < 4; j++) {
suma += this.getElementAt(j + 1)
* matrix.getElementAt(j + 1, i + 1);
}
result[i] = suma;
}
} catch (... | 3 |
@Override
public Solution runAlgorithm() {
for (int iter = 0; iter < maxiter; iter++) {
best = determineBest(population);
System.out.println((iter + 1) + ": " + best.getFitness());
if (best.getFitness() >= minFit) {
return best;
}
List<Solution> newSols = new ArrayList<>(popSize);
newSols.add(b... | 8 |
public static void main(String[] args) {
final int TOP_LIMIT = 10000;
int[] divisorTotals = new int[TOP_LIMIT + 1];
int totalSum = 0;
//store divisor totals in array
for (int i = 1; i <= TOP_LIMIT; i++) {
//1 is divisible by every number, don't need ... | 8 |
public void testWithers() {
DateMidnight test = new DateMidnight(1970, 6, 9, GJ_DEFAULT);
check(test.withYear(2000), 2000, 6, 9);
check(test.withMonthOfYear(2), 1970, 2, 9);
check(test.withDayOfMonth(2), 1970, 6, 2);
check(test.withDayOfYear(6), 1970, 1, 6);
check(test.wi... | 2 |
public void testWithers() {
YearMonth test = new YearMonth(1970, 6);
check(test.withYear(2000), 2000, 6);
check(test.withMonthOfYear(2), 1970, 2);
try {
test.withMonthOfYear(0);
fail();
} catch (IllegalArgumentException ex) {}
try {
tes... | 2 |
@Test
public void testPutGetMessagesInOrder() {
try {
int noOfMessages = 5;
final CountDownLatch gate = new CountDownLatch(noOfMessages);
final ArrayList<Message> list = new ArrayList<Message>(noOfMessages);
for (int i = 0; i < noOfMessages; i++) {
Message msg = new MockMessage("TestMessage");
li... | 3 |
char processAmpersand()
throws XMLMiddlewareException, IOException, EOFException
{
char c;
switch (entityState)
{
case STATE_DTD:
throwXMLMiddlewareException("Invalid general entity reference or character reference.");
case STATE_ATTVALUE:
if (getCh... | 8 |
public void testTextToTerm2() {
String text1 = "fred(?,2,?)";
String text2 = "[first(x,y),A]";
Term plist = Util.textToTerm(text2);
Term[] ps = plist.toTermArray();
Term t = Util.textToTerm(text1).putParams(ps);
assertTrue("fred(?,2,?) .putParams( [first(x,y),A] )", t.hasFunctor("fred", 3) && t.arg(1).hasFu... | 6 |
public final void writeNewSongbookData(final File masterPluginData) {
final OutputStream outMaster;
outMaster = this.io.openOut(masterPluginData);
try {
// head
this.io.write(outMaster, "return\r\n{\r\n");
// section dirs
this.io.write(outMaster, "\t[\"Directories\"] =\r\n\t{\r\n");
final Iterato... | 5 |
private static synchronized int getCounter() {
return counter++;
} | 0 |
public String getImportFileFormatNameForExtension(String extension) {
String lowerCaseExtension = extension.toLowerCase();
for (int i = 0, limit = importers.size(); i < limit; i++) {
OpenFileFormat format = (OpenFileFormat) importers.get(i);
if (format.extensionExists(lowerCaseExtension)) {
return (String... | 3 |
@SuppressWarnings("unchecked")
public String getTeamData() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT id, match_number, auton_top*6 + auton_middl... | 3 |
@Test
public void testTimes() {
calculator.pushOperand(3.0);
calculator.pushOperand(2);
calculator.pushTimesOperator();
calculator.evaluateStack();
assertEquals(6.0, calculator.popOperand(), 0);
} | 0 |
@EventHandler(priority=EventPriority.LOW)
public void preCraftEvent(PrepareItemCraftEvent event) {
if(event.getViewers() == null || event.getRecipe() == null)
return;
Material mat = event.getRecipe().getResult().getType();
if(event.isRepair()) {
for(HumanEntity he: e... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Json other = (Json) obj;
if (!Objects.equals(this.json, other.json)) {
return false;
... | 3 |
public static void extractArguments(String[] args, String argumentPrefix, Map<String, String> _arguments, List<String> _nonArguments)
throws InvalidArgumentException {
if (null == args || args.length == 0) return;
Map<String, String> arguments = new TreeMap<String, String>();
List<String> nonArguments = new A... | 9 |
private String trimStr(String str,char ch) {
if(str == null) return null;
str = str.trim();
int count = str.length();
int len = str.length();
int st = 0;
char[] val = str.toCharArray();
while ((st < len) && (val[st] == ch)) {
st++;
}
while ((st < len) && (val[len - 1] == ch)) {
len--;
}
... | 7 |
private Vector<Integer> getIdList(String csv[], boolean parent) {
Vector<Integer> results = new Vector<Integer>(this.ruleList.size());
results.setSize(this.ruleList.size());
for (int j = 0; j < this.ruleList.size(); j++) {
results.set(j, j);
}
for (int j = 0; j < csv.length; j++) {
int k = 0;
for ... | 8 |
private Class getClassObject(String name) throws ClassNotFoundException {
if (useContextClassLoader)
return Thread.currentThread().getContextClassLoader()
.loadClass(name);
else
return Class.forName(name);
} | 1 |
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(obj instanceof Build) {
Build that = (Build)obj;
return this.id == that.id
&& this.name != null ? this.name.equals(that.name) : this.name == that.name
... | 9 |
private void resaveParamsSaveCity(SessionRequestContent request) {
String currCountry = request.getParameter(JSP_CURR_ID_COUNTRY);
if (currCountry != null && !currCountry.isEmpty()) {
request.setAttribute(JSP_CURR_ID_COUNTRY, currCountry);
}
createCurrCity(request);
} | 2 |
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.