text stringlengths 14 410k | label int32 0 9 |
|---|---|
private double getGameDuration() {
// Return nothing if we don't have sufficient information.
if(this.roundStats.size() == 0)
return -1;
// Get our round duration
double seconds = 0;
for(RoundStats curRoundStats : this.roundStats)
seconds += curRoundStats.getDuration();
return seconds;
} | 2 |
@Override
protected void run(Player player, String[] args) {
if(player.isOp()){//TODO add permissions
if (args[0].equalsIgnoreCase("set")) {
SetCommand.set(player, args);
} else if (args[0].equalsIgnoreCase("replace")) {
ReplaceCommand.replace(player, arg... | 7 |
private static void startDisruptor() {
// 创建处理查询消息的disruptor
_disruptor =
new Disruptor<TicketQueryArgs>
(
TicketPoolService.QueryFactory,
EXECUTOR,
new SingleThreadedClaimStrategy(RING_SIZE),
new BlockingWaitStrategy()
);
// @brucesea
// 另外用Disruptor,推荐用DisruptorWiz... | 0 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char grade = in.next().charAt(0);
switch (grade) {
case 'A':
System.out.println("Excellent");
break;
case 'B':
System.out.println("Good");
... | 5 |
public void handleLeftClick(double x, double y, SUIComponent concerned){
if(save.equals(concerned))
exit(true);
else if(cancel.equals(concerned))
exit(false);
else if(leftCtrl.equals(concerned))
current = InteractivePanel.LEFT;
else if(rightCtrl.equals(concerned))
current = InteractivePanel.RIGHT;
... | 7 |
public static void main(String args []) throws ParseException
{
EG1 parser = new EG1(System.in);
while (true)
{
System.out.println("Reading from standard input...");
System.out.print("Enter an expression like \u005c"1+(2+3)*4;\u005c" :");
try
{
switch (EG1.one_line())
... | 5 |
private Predicate[] getSearchPredicates(UserBE searchParameters, Root<UserBE> root) {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
List<Predicate> predicatesList = new ArrayList<Predicate>();
String firstName = searchParameters.getFirstName();
if (firstName != null && !"".equals(firstNam... | 7 |
public void actionPerformed(ActionEvent e){
if (e.getSource() == JMINowaGra){
//JOptionPane.showMessageDialog(null, "Nowa gra");
this.setEnabled(false);//zablokowanie okna
Goptions = new GameOptions(this);
Goptions.setVisible(true);
}
if (e.getSource() == JMIReset){
JOptionPane.showMessa... | 8 |
private void fireMouseExitedToSource(DropTargetDropEvent e)
{
try
{
Transferable transferableProxy = e.getTransferable();
Class<?> proxyClass = transferableProxy.getClass();
Field dropTargetContextPeerField = proxyClass.getDeclaredField("transferable"... | 5 |
private boolean matchTree(TreeNode<?> root1, TreeNode<?> root2) {
if (root1 == null && root2 == null) {
return true;
}
if (root1 == null || root2 == null) {
return false;
}
if (root1.data != root2.data) {
return false;
}
return matchTree(root1.left, root2.left)
&& matchTree(root1.right, ro... | 8 |
public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
// Print the balanc... | 1 |
@Override
public void execute(CommandSender sender, String[] args) {
if (!sender.hasPermission("bungeeutils.admin")) {
sender.sendMessage(new ComponentBuilder("").append(plugin.prefix + plugin.messages.get(EnumMessage.NOPERM)).create());
return;
}
if (args.length != ... | 3 |
public final void decodeFilename(byte[] filename, char escape, StringBuilder sb) {
for (int i = 0; i < filename.length; i++) {
byte b = filename[i];
char c = decode(b);
if ((c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A) || (c >= 0x30 && c <= 0x39) || " !'._-".indexOf(c)... | 8 |
public void addStaffInfo(Vector<StaffInfo> staff, JTextField[] staffTF, JList positionList, JList qualificationList,
String hospitalList, JTable table) {
DB.db.openConnection();
try {
int posid = -1;
int qualid = -1;
int hospId = -1;
String[] t... | 9 |
public void printRules() {
if ((rules != null) && (rules.size() > 0)) {
OutputWriter.println(MSG_LIST_OF_RULES);
for (Rule rule : rules) {
OutputWriter.println(rule.toString());
}
} else {
OutputWriter.println(MSG_EMPTY_LIST_OF_RULES);
}
} | 3 |
public void recalculateBytes()
{
chan.setValues(vol.getValue(),freq.getValue(),dur.getValue(),eq.getText());
int duration = (int) (dur.getValue() / 1000.0 * sps);
myEnviron.put("sps",sps);
myEnviron.put("bps",sps);
myEnviron.put("dur",duration);
myEnviron.put("period",sps / (double) freq.getValue());
my... | 4 |
public InetAddress getDccInetAddress() {
return _dccInetAddress;
} | 0 |
public void upgrade(int building, int advance) {
if (88 == advance) {//adjusting for UnitTypes
advance = 58;
} else if (90 == advance) {
advance = 59;
} else if (89 == advance) {
advance = 103;
} else if (91 == advance) {
advance = 104;
} else if (97 == advance) {
advance = 106;
} else if (99... | 8 |
public static void pointsRemoved(String prestige, int ap){
pointsSpent -= ap;
//update the trees points spent
for(ClassTree ct : takenPrestigeTrees){
if(ct.getPrestige().equalsIgnoreCase(prestige))
ct.removeAp(ap);
}
if(prestige.equalsIgnoreCase(characterRace))
racialTree.removeAp(ap);
} | 3 |
public BotWindow(String title, Bot bot) {
super(title);
this.bot = bot;
setClosable(true);
setResizable(true);
setIconifiable(true);
setMaximizable(true);
textField = new JTextField();
textField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent ze) {
if (z... | 1 |
@Override
public void affectCharStats(MOB affectedMOB, CharStats affectedStats)
{
if(EQadjCharStats==null)
{
setMiscText(text());
/*
* ************************* Armor-based Resistances
* *************************
*/
}
if((affected!=null)&&(affected instanceof Armor)&&(!(affected instanceof S... | 7 |
public Color brighter() {
int r = red;
int g = green;
int b = blue;
/*
* From 2D group: 1. black.brighter() should return grey 2. applying
* brighter to blue will always return blue, brighter 3. non pure color
* (non zero rgb) will eventually return white
*/
int i = (int) (1.0 / (1.0 - FACTOR));
... | 9 |
protected void createSubbands()
{
int i;
if (mode == Header.SINGLE_CHANNEL)
for (i = 0; i < num_subbands; ++i)
subbands[i] = new SubbandLayer1(i);
else if (mode == Header.JOINT_STEREO)
{
for (i = 0; i < header.intensity_stereo_bound(); ++i)
subbands[i] = new SubbandLayer1Stere... | 6 |
void destruct() {
playerListSize = 0;
for(int i = 0; i < maxPlayerListSize; i++) playerList[i] = null;
npcListSize = 0;
for(int i = 0; i < maxNPCListSize; i++) npcList[i] = null;
absX = absY = -1;
mapRegionX = mapRegionY = -1;
currentX = currentY = 0;
resetWalkingQueue();
} | 2 |
public boolean accept(File pathname)
{
if (pathname != null
&& pathname.getName().toUpperCase().endsWith(mFilter))
{
return true;
}
return false;
} | 2 |
public static int getID(Packets packet){
return packet.id;
} | 0 |
@EventHandler
public void EndermanHarm(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Harm... | 6 |
public static Throwable getCause(final Throwable exception) {
// Figure out which exception should actually be logged -- if the given exception is
// a wrapper, unwrap it
Throwable cause = null;
if (exception != null) {
if (exception instanceof CoreException) {
// Workaround: CoreException contains a ca... | 8 |
@Override
public void publish(LogRecord record) {
if(open&&!closing) {
Level l = record.getLevel();
String loggerName = record.getLoggerName();
String message = record.getMessage();
Calendar c = Calendar.getInstance();
c.setTimeInMillis(record.getMillis());
String time = new SimpleDateFormat("dd.HH... | 3 |
float next(final float len) {
final float targetLength = lenAtLastSplit + len;
while (lenAtNextT < targetLength) {
if (done) {
lastSegLen = lenAtNextT - lenAtLastSplit;
return 1f;
}
goToNextLeaf();
... | 9 |
@Override
public void update() {
paddleLeft.update();
paddleRight.update();
movingPaddleLeft.update();
movingPaddleRight.update();
ball.update();
if (ballCollides(paddleLeft)) {
playerScore++;
ball.onCollideWith(paddleLeft);
Resour... | 5 |
void generateLeafNodeList()
{
height = (int)((double)heightLimit * heightAttenuation);
if (height >= heightLimit)
{
height = heightLimit - 1;
}
int i = (int)(1.3819999999999999D + Math.pow((leafDensity * (double)heightLimit) / 13D, 2D));
if (i < 1)
... | 8 |
private Rectangle adjustWindowPositionToScreen(final Rectangle windowPosition) {
// Get the size of the screen
final Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
if (windowPosition.width > dim.width) {
windowPosition.width = dim.width;
}
if (windowPosition.height > dim.height) {
windo... | 6 |
private void writeHtmlScrptExpr(FileWriter fwriter) throws IOException {
int exprIndexPointer = 0;
int indexExpr = 0;
int sizeExprIndex = expresionIndex.size();
int scrptIndexPointer = 0;
int indexScrpt = 0;
int sizeScrptIndex = scriptletIndex.size();
for (int i = 0; i < html.size(); i++) {
String s... | 7 |
public int getMaxMP() {
return maxMP;
} | 0 |
public int draw(boolean fromDiscard){
//Make sure there are the correct number of cards in play
assert(dealing || (draw_count+discard_count == rack_size*2 && !action));
turns++;
action = true;
int card;
if (fromDiscard){
assert(discard_count != 0);
card = discard[--discard_count];
}
else{
asser... | 5 |
static final public String EqualityExpression() throws ParseException {
String tmp1="",tmp3="";Token tmp2=null;
tmp1 = RelationalExpression();
if (jj_2_22(2)) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 93:
tmp2 = jj_consume_token(93);
break;
c... | 8 |
public int score(Collection<String> names) {
int sum = 0;
for( String name : names ) {
if( scoreByName.get(name) == null ) throw new RuntimeException("Error: Entry '" + name + "' not found!");
sum += scoreByName.get(name);
}
return sum;
} | 2 |
public static String countAndSay(int n) {
String seed = "1";
for (int i = 1; i < n; i++) {
int index = 0;
String seed2 = "";
char say = seed.charAt(index);
int count = 0;
int outIndex = 0;
while (index < seed.length()) {
... | 4 |
public static String stripHTML( String rep )
{
// first convert newlines
rep = rep.replaceAll( "<[B,b][R,r]?>", "\r\n" );
rep = rep.replaceAll( "<[B,b][R,r]?/>", "\r\n" );
rep = rep.replaceAll( "<[L,l][I,i]?>", "\r\n\r\n" );
StringBuffer ret = new StringBuffer();
char[] cx = rep.toCharArray();
boolean... | 5 |
public void itemStateChanged(ItemEvent ie) {
if (ie.getSource().equals(jcb)) {
cl.show(p, jcb.getSelectedItem().toString());
page[jcb.getSelectedIndex()].refreshScale();
back.setEnabled(jcb.getSelectedIndex() == 0 ? false: true);
forward.setEnabled(jcb.getSelectedIndex() == jcb.getItemCount()-1 ? false:tr... | 4 |
private void closure() {
HashSet selected = new HashSet();
GrammarTableModel model = choiceTable.getGrammarModel();
for (int i = 0; i < model.getRowCount() - 1; i++)
if (choiceTable.isRowSelected(i))
selected.add(model.getProduction(i));
if (selected.size() == 0) {
JOptionPane.showMessageDialog(parent... | 4 |
public void addingTreesForDomSet(ArrayList<Integer> terminalsId) {
HashSet<ElkinItem> realChosenItem = new HashSet<ElkinItem>();
realChosenPseudo = new HashSet<PseudoNode>();
int [][]P = uninformedAdjMatrix.getP2PPath();
double [][]MCPmatrix = uninformedAdjMatrix.getP2PCost();
for (i... | 8 |
public static BrainState getRandomBrainState(AntColour colour) {
// Create a new BrainState with i as the stateId
BrainState brainState = new BrainState();
// Set the Instruction
Instruction instruction = getRandom(Instruction.class);
brainState.setInstruction(instruction);
// Determine the additio... | 9 |
private void addEdges()
{
for(int i=initialGraphSize;i<graph.getSize();i++)
{
int numberOfEdges=(int) (2+Math.random()*6);
int [] adjacent = new int[numberOfEdges];
for(int j=0; j<numberOfEdges; j++)
{
int id= (int) ((Math.random()*(graph.getSize()))+1);
for(int k=0;k<j;k++)// ensures all e... | 6 |
private void updateCreature(Creature creature,
long elapsedTime)
{
// apply gravity
if (!creature.isFlying()) {
creature.setVelocityY(creature.getVelocityY() +
GRAVITY * elapsedTime);
}
// change x
float dx = creature.getVelocityX();
... | 9 |
public void testFormatPrefixPlural3() {
try {
builder.appendPrefix(null, "");
fail();
} catch (IllegalArgumentException ex) {}
try {
builder.appendPrefix("", null);
fail();
} catch (IllegalArgumentException ex) {}
try {
... | 3 |
private static int Chain(String number, HashMap<String, Integer> memoized) {
Integer savedValue = (Integer) memoized.get(number);
if (savedValue != null) {
// System.out.println(number + " -> " + savedValue + " (Memoized)");
return savedValue;
} else if ("1".equals(number... | 5 |
public static boolean isFullPattern(final String pattern) {
boolean full = true;
final Matcher m = Pattern.compile(GROUP).matcher(pattern);
if (m.find()) {
int level = 0;
final int l = pattern.length() - 1;
int i = 0;
while ((i < l) && full) {
final char c = pattern.charAt(i);
if (c == '(') ... | 9 |
@Test
public void getEdgeByVertices() {
Vertex a = new Vertex(0);
Vertex b = new Vertex(1);
Edge e = new Edge(a, b);
g.addVertex(a);
g.addVertex(b);
g.addEdge(a, b, 1);
assertTrue(g.getEdgeByVertices(a, b).equals(e));
} | 0 |
public static void main(String[] args) {
//Instantiate an object of BufferedReader, called br.
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//Instantiate an object of HashMap, called hm.
HashMap<String, Student> hm = new HashMap<String, Student>();
//Ask user how many students they want t... | 2 |
public static SeekableInput replaceInputStreamWithSeekableInput(InputStream in) {
if (in instanceof SeekableInput)
return (SeekableInput) in;
SeekableInput sin = null;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
/*
byte[] b... | 4 |
private static Vec2 generateRandomPos(Mob mob, double radius, Vec2 dir) {
// boolean hasBest = false;
// int xBest = 0, yBest = 0, zBest = 0;
// double best = -99999;
Random random = TurnSynchronizer.synchedRandom;
Vec2 pos = new Vec2();
for (int i = 0; i < 10; i++) {
// in a square for now...
pos.s... | 5 |
public Star(Animation anim) {
super(anim);
} | 0 |
public static Stella_Object accessXmlElementSlotValue(XmlElement self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_NAMESPACE_NAME) {
if (setvalueP) {
self.namespaceName = ((StringWrapper)(value)).wrapperValue;
}
else {
value = String... | 6 |
public void save(DataOutputStream out) throws IOException {
super.save(out);
for (int i = 0; i<4 ; i++) {
if (lines[i].isEmpty()){
out.writeUTF("");
} else {
out.writeUTF(lines[i]);
}
}
} | 2 |
public static GeneralValidator isEqual() {
return EQUALS_VALIDATOR;
} | 0 |
public String toCSV() {
return super.toCSV();
} | 0 |
private void executeSavedAction(char action){
try {
if (action == 'r') primaryService.movePlayer(this.shServiceClient, 'r');
else if (action == 'l') primaryService.movePlayer(this.shServiceClient, 'l');
else if (action == 'd') primaryService.movePlayer(this.shServiceClient, 'd');
else i... | 5 |
private Station createStation() throws StorageReaderException {
String name = null;
try {
name = nextString();
int price = nextInt();
int[] income = new int[4];
for(int i = 0; i < income.length; i++) {
income[i] = nextInt();
}
int mortgage = nextInt();
if(!isEndOfBlock()) {
throw new En... | 3 |
public void Solve() {
int previousNumerator = 0;
int previousDenominator = 1;
double previousValue = 0;
double targetValue = 3 / 7.0;
for (int d = 2; d <= _max; d++) {
// System.out.println(d);
int upper = d / 2 + 1;
int lower = 1;
... | 9 |
public int cdlEveningDojiStarLookback( double optInPenetration )
{
if( optInPenetration == (-4e+37) )
optInPenetration = 3.000000e-1;
else if( (optInPenetration < 0.000000e+0) || (optInPenetration > 3.000000e+37) )
return -1;
return ((( ((( (this.candleSettings[CandleSettingType.B... | 6 |
public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int len = s.length();
for (int i = 0; i < len; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' || c =... | 6 |
public static void main(String[] args) {
// TODO Auto-generated method stub
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
List<File> files = new ArrayList<>();
files.add(new File("TestClass1.java"));
... | 4 |
public byte[] toRedisField()
{
byte[] toReturn = new byte[row.length + cf.length + cq.length + 2];
int i = 0;
for (byte b : row)
{
toReturn[i] = b;
i++;
}
toReturn[i] = Utils.RECORD_SEPARATOR;
i++;
for (byte b : cf)
{
toReturn[i] = b;
i++;
}
toReturn[i] = Utils.RECORD_SEPARATOR;
i++... | 3 |
public VueRecherche() {
/* Background */
/*
* ImageIcon icon = new ImageIcon("img//gdeFond2.jpg"); JLabel img = new
* JLabel(icon); add(img);
*/
rech = new JTextField(15);
rech.setText("Saisir mots-clés...");
rech.setBackground(new Color(227, 231, 244));
rech.addKeyListener(new KeyListener() {
p... | 1 |
public static void loadConfig() {
// Audio
float musicVolume = new Float(getProperty("music", "1f"));
SoundStore.get().setMusicVolume(musicVolume);
SoundStore.get().setCurrentMusicVolume(musicVolume);
float sfxVolume = new Float(getProperty("sfx", "1f"));
SoundStore.get().setSoundVolume(sfxVolume);
// ... | 2 |
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + baggageCurWeight;
result = prime * result + baggageMaxWeight;
result = prime * result
+ ((comfortType == null) ? 0 : comfortType.hashCode());
result = prime * result + passengerCurCount;
r... | 1 |
public void constructPizza() {
pizzaBuilder.createNewPizzaProduct();
pizzaBuilder.buildDough();
pizzaBuilder.buildSauce();
pizzaBuilder.buildTopping();
} | 0 |
public void setGradeLevel(String gradelevel) {
this.gradelevel = gradelevel;
} | 0 |
public void setUserinfo(String p_userinfo) throws MalformedURIException
{
if (p_userinfo == null)
{
m_userinfo = null;
}
else
{
if (m_host == null)
{
throw new MalformedURIException(
"Userinfo cannot be set when host is null!");
}
// userinfo can c... | 9 |
@Override
public double evaluate(final double z) {
if (z < x[0]) {
return y[0];
} else if (z > x[x.length - 1]) {
return y[y.length - 1];
}
for (int i = 0; i < x.length - 1; i++) {
if (z >= x[i] && z <= x[i + 1]) {
// // a*(x-b) + c
// final double a = (y[i + 1] - y[i]) / (x[i + 1] - x[i]);
... | 5 |
public void newFrameAtRunTimeStack(int offset) {
runStack.newFrameAt(offset);
} | 0 |
public String longestPalindrome(String s) {
for (int l = s.length(); l > 0; l--) {
for (int i = s.length() - l; i > -1; i--) {
if (isPalindorme(s, i, i + l - 1))
return s.substring(i, i + l);
}
}
return null;
} | 3 |
@EventHandler
public void EndermanWeakness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.... | 6 |
@Override
public String toString() {
switch(this) { // "this" is one of the enumerated type values
case ACE:
return "Ace";
case JACK:
return "Jack";
case QUEEN:
return "Queen";
case KING:
return ... | 4 |
@Override
public String getDbname() {
return dbname;
} | 0 |
protected Markers readMarkers(String fileName) {
Markers markersSeqChange = Markers.readMarkers(fileName);
String label = Gpr.removeExt(Gpr.baseName(fileName));
// Convert 'SeqChange' markers to 'Custom' markers
Markers markers = new Markers();
for (Marker m : markersSeqChange) {
Custom custom = new Custo... | 2 |
public boolean isEmptyCluster(Hashtable<Room,MapRoom> processed, int x, int y)
{
for(final Enumeration<MapRoom> e=processed.elements();e.hasMoreElements();)
{
final MapRoom room=e.nextElement();
if((((room.x>x-CLUSTERSIZE)&&(room.x<x+CLUSTERSIZE))
&&((room.y>y-CLUSTERSIZE)&&(room.y<y+CLUSTERSIZE)))
||(... | 7 |
public int do300baudFFT (CircularDataBuffer circBuf,WaveData waveData,int start) {
// Get the data from the circular buffer
double samData[]=circBuf.extractDataDouble(start,26);
double datar[]=new double[FFT_64_SIZE];
// Run the data through a Blackman window
int a;
for (a=0;a<datar.length;a++) {
if ((a>... | 3 |
@Override
public int compareTo(PokerHandValue pokerHandValue) {
if(Value.equals(pokerHandValue.Value) && Rank.equals(pokerHandValue.Rank))
return 0;
if(Rank.compareTo(pokerHandValue.Rank) == 0 && Rank == PokerHandRank.Two_Pair)
return CompareTwoPair(pokerHandValue);
... | 8 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
private static void intArToByteAr() {
bAr[0] = (byte)'4';
//Bounds check ints in tableAr for byte conversion
for (int y = 0; y < tableAr.length; y++)
for (int x = 0; x < tableAr[y].length; x++)
if (tableAr[y][x] > 255) tableAr[y][x] = 255;
else if (tableAr[y][x] < 0) tableAr[y][x] = 0;
if (Led... | 9 |
protected static String getCurrentElement( XmlPullParser xpp )
{
StringBuffer el = new StringBuffer();
try
{
int eventType = xpp.getEventType();
String elname = xpp.getName();
while( eventType != XmlPullParser.END_DOCUMENT )
{
if( (eventType == XmlPullParser.START_TAG) || (eventType == XmlPullPar... | 7 |
static public void generateLevel(ru.mipt.cs.level_generator.Difficulty diff, double size) {
LvlGenerator.size = size;
int numberOfFields = GetConfigByDiff.numberOfFields(diff);
int numberOfFZones = GetConfigByDiff.numberOfFZones(diff);
int numberOfObs = GetConfigByDiff.numberOfObs(diff);... | 9 |
public static <T> List<List<T>> array_chunk(List<T> arr, int page) {
if (arr == null) return new ArrayList<List<T>>();
if (page < 1) return new ArrayList<List<T>>(); // hmm. GIGO.
List<List<T>> output = new ArrayList<List<T>>();
int count = 0;
while (arr.size() > count) {
int newCount = count + page;
if... | 4 |
public void insert(ListNode node, int index) {
ListNode currentNode = root;
ListNode beforeNode = root;
int currentIndex = 0;
if (!isEmpty() && index >= 0 && index <= size()) {
// iterate to index
while (currentNode != null && currentIndex != index) {
beforeNode = currentNode;
currentNode = curr... | 6 |
@Override
public void run() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
protected int addPacket(OggPacket packet, int offset) {
if(packet.isBeginningOfStream()) {
isBOS = true;
}
if(packet.isEndOfStream()) {
isEOS = true;
}
// Add on in 255 byte chunks
int size = packet.getData().length;
for(int i = numLVs; i<... | 5 |
public boolean checkAntiDiagonal(){
// diagonal upper right to lower left (anti-diagonal)
for (int col = numColumns - 1; col >= 3; col--) {
for (int row = 0; row < numRows - 3; row++) {
int curr = gameGrid[col][row].getState();
if (curr > 0
... | 6 |
public List<Float> getFloatList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Float>(0);
}
List<Float> result = new ArrayList<Float>();
for (Object object : list) {
if (object instanceof Float) {
r... | 8 |
public String llenaCatalogo(ArrayList<String> elementos) {
String opcion = "<option label='";
String opcion_ = "/>";
String res = "";
for (String elem : elementos) {
res += opcion + elem + "' " + "value='" + elem + "' " + opcion_ + "\n";
}
return res;
} | 1 |
@Override
public void callOperationAsynchronously(final String operationName, final CallbackListener listener,
final int periodMs, final Object... arguments) {
final String serviceName = getName();
Thread thread = new Thread() {
public void run() {
try {
OrocosOperation operation = getOperation(... | 8 |
public String getInstallDate() {
return installdate;
} | 0 |
private static String dirString(DirKey dk){
if(dk==DirKey.Up){
return "up";
}
else if(dk==DirKey.Down){
return "down";
}
else if(dk==DirKey.Left){
return "left";
}
else if(dk==DirKey.Right){
return "right";
}
else{
return "else";
}
} | 4 |
private final void method4006(BufferedStream buffer, int i, byte b, int i_0_) {
anInt4337++;
if (i_0_ != 1) {
if ((i_0_ ^ 0xffffffff) != -3) {
if ((i_0_ ^ 0xffffffff) == -4) {
buffer.readByte();
} else if ((i_0_ ^ 0xffffffff) == -5) {
anInt4324 = buffer.readUnsignedByte();
} else if (i_0_ =... | 9 |
public void updateEntity()
{
if (this.brewTime > 0)
{
--this.brewTime;
if (this.brewTime == 0)
{
this.brewPotions();
this.onInventoryChanged();
}
else if (!this.canBrew())
{
this.... | 6 |
public int moveByInt(int direction){
int moved = 0;
switch(direction){
case 0: moved=this.left();
break;
case 1: moved=this.right();
break;
case 2: moved=this.up();
break;
case 3: moved=this.down();
break;
}
return moved;
} | 4 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
... | 8 |
private static void processKey(Object id, SelectionKey key, SelectorManager2 mgr) throws IOException, InterruptedException {
if(log.isLoggable(Level.FINEST))
log.finest(id+""+key.attachment()+"proccessing");
//This is code to try to avoid the CancelledKeyExceptions
if(!key.channel().isOpen() || !key.isValid()... | 7 |
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.