text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Test
public void enqueueTest() {
for (int i = 1; i < 8; i++) {
System.out.println("");
printTime(testArrayDequeEnqueue(100000 * (int) Math.pow(2, i)));
printTime(testQueueEnqueue(100000 * (int) Math.pow(2, i)));
}
} | 1 |
public boolean isAccessible(Case caseP){
return (this instanceof RobotRoues && (caseP.getNature() == NatureTerrain.TERRAIN_LIBRE || caseP.getNature() == NatureTerrain.HABITAT))
|| (this instanceof RobotChenilles && (caseP.getNature() != NatureTerrain.EAU) && (caseP.getNature() != NatureTerrain.ROCHE))
|| ... | 8 |
public static void display_all(List<?> list) {
for (Object t : list ){
System.out.println(t);
}
} | 2 |
public void outputBarChart() {
System.out.println("Grade distribution: ");
int[] frequency = new int[11];
for(int grade : grades) {
++frequency[grade/10];
}
for(int count = 0; count < frequency.length; count++) {
... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PolicyImpl other = (PolicyImpl) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return fa... | 6 |
public void parse() throws GOLException {
try {
checkFile();
buildBoard();
} catch (IOException ioE) {
throw new GOLException("Die Datei konnte nicht geöffnet werden.");
}
} | 1 |
public static void open(boolean startnew)
{
if(closed == false)
{
try{
out.close();
closed = true;
}catch(IOException e){
System.out.println("ChangesFile.open IOException: " + e.toString());
}
}else{System.out.println("changesfile error");}
try{
File file = new File(path);
java.awt.Des... | 6 |
public List<String> findGame(String gameName)
{
List<String> games = new ArrayList<String>();
String searchURL = "http://videogames.pricecharting.com/search?q=" + gameName.trim();
String line = "";
//Trys to connect to pricecharting and search.
try
{
URL url = new URL(searchURL);
BufferedReader ... | 7 |
public static void main(String[] args) {
testVerifierLoginMdp();
testSelectAll();
} | 0 |
public static boolean isKSparse(long num, int k) {
if (num <= 0 || num == 1) {
return false;
}
if ((num & (num - 1)) == 0) {
return true;
}
while (num > 0) {
if ((num & 1) > 0) {
int zcount = 0;
num >>= 1;
while ((num > 0) && ((num & 1) == 0)) {
zcount++;
num >>= 1;
}
... | 9 |
void processMongoDBComand(Command cmd) {
String sqlQuery = "";
/**
* Insert type of query.
*/
if(cmd.getType().equals(SELECT))
{
sqlQuery += (SELECT + EMPTY_SPACE);
}
/**
* Insert columns to filter.
... | 9 |
protected PlayerEntity(final Vector2d pos, final Vector2d dir) {
super(pos, dir);
switch ((int) (Math.random() * 3)) {
case COLOR_RED:
colorID = COLOR_RED;
img = ImageLoader.ship_red;
break;
case COLOR_GREEN:
colorID = COLOR_GREEN;
img = ImageLoader.ship_green;
break;
case COLOR_BLUE:
co... | 3 |
private void closeRequest(OnDemandData onDemandData)
{
try
{
if(socket == null)
{
long l = System.currentTimeMillis();
if(l - openSocketTime < 4000L)
return;
openSocketTime = l;
socket = clientInstance.openSocket(43594 + client.portOff);
inputStream = socket.getInputStream();
outputStr... | 7 |
public final Object put(Object key, Object value) {
int h;
for (h = firstIndex(key); table[h] != null; h = nextIndex(h)) {
if (key.equals(table[h])) {
h |= halfTableLength;
Object tem = table[h];
table[h] = value;
return tem;
}
}
if (used >= usedLimit) {
// rehash
halfTableLe... | 7 |
public boolean almostEquals(Object obj) {
if (this == obj)
return true;
if (getClass() != obj.getClass())
return false;
Term other = (Term) obj;
if (parts == null) {
if (other.parts != null)
return false;
} else if (!parts.equals(other.parts))
return false;
return true;
} | 5 |
private int[][] generateTerrain(int s, double sea, double shore, double forest, double v, long sd){
int[][] terrain = new int[s][s];
HeightMapGenerator g = new HeightMapGenerator();
g.setSize(s, s);
g.setVariance(v);
g.setSeed(sd);
Random r = new Random();
r.setSeed(sd);
double[]... | 7 |
public boolean retainAll(Collection<?> c){
if(c == null)
return false;
if(c.isEmpty()){
clear();
return true;
}
boolean modStatus = false;
for(int i = 0; i < size; i++){
if(!c.contains(elements[i])){
remove(i);
i--;
modStatus = true;
}
}
return (modStatus) ? true : false;
} | 6 |
public void test_1() {
// Data calculated using R:
// x <- 1:100
// pchisq(x,1,lower.tail=F)
double chiSqPcomp[] = { 3.173105e-01, 1.572992e-01, 8.326452e-02, 4.550026e-02, 2.534732e-02, 1.430588e-02, 8.150972e-03, 4.677735e-03, 2.699796e-03, 1.565402e-03, 9.111189e-04, 5.320055e-04, 3.114910e-04, 1.828106e... | 2 |
private static File[] removeDotFiles( File[] versions )
{
Vector<File> files = new Vector<File>();
for ( int i=0;i<versions.length;i++ )
if ( !versions[i].getName().startsWith(".")
&& versions[i].isFile() )
files.add( versions[i] );
versions = new File[files.size()];
files.toArray( versions );
re... | 3 |
private FSALabelHandler() {
} | 0 |
public Object getField(Reference ref, Object obj)
throws InterpreterException {
if (isWhite(ref))
return super.getField(ref, obj);
FieldIdentifier fi = (FieldIdentifier) Main.getClassBundle()
.getIdentifier(ref);
if (fi != null && !fi.isNotConstant()) {
Object result = fi.getConstant();
if (curren... | 5 |
public void update() {
super.update();
try {
if (motorRunning)
movement();
} catch (Throwable t) {
motorRunning = false;
getArena().motorFailure(SpriteMobile.this, t);
}
} | 2 |
public void scanColumn(int columnPoint) {
HashMap<Integer, SpanInfo> rowMap = new HashMap<Integer, SpanInfo>();
SpanInfo si = new SpanInfo();
si.name = originTable[0][columnPoint];
si.row = 0;
si.num = 0;
rowMap.put(0, si);
for (int i = 0; i < originTable.length; i++) {
if (si.name.equals(originTable[i... | 7 |
public static void analyzeListSorts(){
TreeMap<Long, Class<?>> map = new TreeMap<Long, Class<?>>();
List<Class<?>> sorts = getSorts();
for(Class<?> clazz : sorts){
sampleListTest(clazz, false);
System.out.println("--------");
}
for(Class<?> clazz : sorts){
long time = sampleListTest(clazz, false);
... | 9 |
@Override
/**
* Decides how to act at a given state of the game
* @param raiseAllowed is it allowed to raise or not
*/
public PlayerAction makeBet(boolean raiseAllowed) throws Exception {
PlayerAction action = new PlayerAction();
action.oldStake = currentBet;
if (folded) {
action.action = PlayerAction.... | 5 |
public void makeManufacturer(String[] names, TechType[] types)
{
if(names.length%3!=0)
Log.errOut("Test: Not /3 names: "+CMParms.toListString(names));
else
{
for(int i=0;i<6;i++)
{
Manufacturer M=CMLib.tech().getManufacturer(names[i]);
if((M!=null)&&(M!=CMLib.tech().getDefaultManufacturer()))
... | 7 |
private void initialPropertyChange(PropertyChangeEvent e) {
switch (e.getPropertyName()) {
case Labels.SEND_INITIAL_DVIEW:
if (e.getOldValue() instanceof DocumentView
&& e.getNewValue() instanceof Integer) {
DocumentView docView = (DocumentView) e.getOldValue();
docCon.addDocView((int) e.getNewValue... | 4 |
public boolean checkCounter(char area){
switch (area){
case 'a': if(counter<6) return false; break;
case 'b': if(counter<16) return false; break;
case 'c': if(counter<2) return false; break;
}
return true;
} | 6 |
@Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} | 2 |
@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
public String viewUserById(@PathVariable int userId, @RequestParam(value = "origin", required = false)String origin, Model model) {
User user = (User)(SecurityContextHolder.getContext().getAuthentication().getPrincipal());
GrantedAuth... | 7 |
public void addShapeList(ShapeList sl, Hashtable<String, ImageArea> areas)
throws Exception {
if (areas != null && areas.size() > 0) {
ImagemapShape imshape = null;
ImageArea area = null;
Shape shape = null;
for (String key : areas.keySet()) {
imshape = null;
area = areas.get(key);
shape =... | 6 |
private boolean acceptLicense() {
StringBuffer licenseText = new StringBuffer();
InputStream is;
try {
JarFile extractJar = new JarFile("extract.jar");
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
} catch (IOException e) {
return true;
}
if (is == null) {
re... | 8 |
public void defineField(String fieldname, String guiname, String type) {
try {
if (fields.contains(fieldname)) return;
if (guiname==null) guiname=fieldname;
fields.add(fieldname);
fieldtypes.put(fieldname,type);
fieldguinames.put(fieldname,guiname);
addGuiComponent(fieldname);
if (cls!=null) {
Field f... | 5 |
public boolean hasHighSeasMove() {
if (canMoveToHighSeas()) return true;
Tile tile = getTile();
if (tile != null && getMovesLeft() > 0) {
for (Tile t : tile.getSurroundingTiles(1)) {
if (t.isDirectlyHighSeasConnected()
&& getMoveType(t).isLegal()) ... | 6 |
private void dyingUpdate(Vector3f orientation, float distance){
double time = ((double)Time.getTime())/((double)Time.SECOND);
double timeDecimals = time - (double)((int)time);
if(deathTime == 0)
deathTime = time;
final float time1 = 0.1f;
final float time2 = 0.3f;
... | 5 |
@Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == addVehicle) {
addVehicle();
} else if (source == removeVehicle) {
removeVehicle();
} else if (source instanceof Vehicle) {
Vehicle vehicle = (Vehicle) source;
if (e.getActionCommand().equals(Constant... | 6 |
public static void welcome() {
} | 0 |
public static boolean cppTypeWithoutInteriorPointersP(StandardObject typespec) {
{ Surrogate basetype = StandardObject.typeSpecToBaseType(typespec);
Stella_Class renamed_Class = ((Stella_Class)(basetype.surrogateValue));
if (StandardObject.arrayTypeSpecifierP(typespec)) {
return (StandardObject... | 8 |
@Override
public void run() {
// First place an order:
for(Course course : Course.values()) {
Food food = course.randomSelection();
table.placeOrder(this, food);
++nPlates;
}
try {
barrier.await();
} catch(InterruptedException i... | 5 |
private static String verifyUrl(String url, ArrayList<String> keyWordsInURL,ArrayList<String> exclusionKeyWords) {
if (!url.toLowerCase().startsWith("http")) {
return null;
}
try {
new URL(url);
}
catch (MalformedURLException e) {
Logger.getLogger(Crawler.class).debug("Exception :"+e.getMessage() + ... | 6 |
public double getLinfDistance(finger_print fp){
double score=0;
double max=0;
for(Integer key : this.feature_map.keySet()){
if(fp.feature_map.containsKey(key)){
score=Math.pow(this.feature_map.get(key)-fp.feature_map.get(key), 1);
if(score >max) max=score;
}
else {
score=Math.pow(this.featu... | 7 |
public void setjLabelPrenom(JLabel jLabelPrenom) {
this.jLabelPrenom = jLabelPrenom;
} | 0 |
public boolean checkIfOne(String num)
{
switch(num)
{
case "one": return true;
case "two": return true;
case "three": return true;
case "four": return true;
case "five": return true;
case "six": return true;
case "seven": return true;
case "eight": return true;
case "nine": return tru... | 9 |
@Override
public Move getMove(Board board) {
InputStreamReader inputStreamReader = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(inputStreamReader);
try {
System.out.print("Starting coord: ");
String s1 = reader.readLine();
Coordinate startingCoord = new Co... | 2 |
public void updateDepsAll(){
updateDeps();
for (GameObject child: children){
child.updateDepsAll();
}
} | 1 |
public String ping() {
if (domain == null || domain.isEmpty())
return "Input domain is not correct";
StringBuffer buf = new StringBuffer();
String s = "";
Process process = null;
try {
process = Runtime.getRuntime().exec("cmd /c " + "ping " + domain);
BufferedReader br = new BufferedReader(new Input... | 5 |
final Class258_Sub2 method2256(byte i) {
anInt8692++;
if (i != -121)
method2256((byte) 33);
if (aClass258_Sub2_8688 == null) {
d var_d = ((AbstractToolkit) aHa_Sub2_8693).aD4579;
Class308.anIntArray3883[3] = anInt8690;
Class308.anIntArray3883[4] = anInt8686;
Class308.anIntArray3883[2] = anIn... | 8 |
public MinecraftApplet(String mine_bin_path, URL[] urls){
this.mine_bin_path = mine_bin_path;
this.urls = urls;
} | 0 |
private boolean isSingleProjectDirectory(File dir) {
List<File> files = dirFilelist(dir);
List<File> dirs = dirDirlist(dir);
for (File f : files) {
for (String ext : PROJECT_EXTENSIONS) {
if (f.getName().endsWith(ext))
return true;
}
}
for (File f : dirs) {
for (String ext : PROJECT_EX... | 7 |
@Override
protected void process(Set<ICollidable> collidables)
{
//Remove finished objects
Iterator<ICollidable> it_remover = collidables.iterator();
while(it_remover.hasNext())
{
if(it_remover.next().isFinished())
{
it_remover.remove();
}
}
for(ICollidable collidable : collidables)
{... | 6 |
public void log(String message) {
if(debug) {
int i = indent.get();
System.out.println(indent(i) + message);
}
} | 1 |
public void keoista(int i) {
int vasen = vasen(i);
int oikea = oikea(i);
int pienin;
if (oikea <= keonKoko) {
if (keko[vasen] < keko[oikea]) {
pienin = vasen;
} else {
pienin = oikea;
}
if (keko[i] > keko[pie... | 5 |
public void trainBtnPress()
{
//make or load a nerual network
//currently we are just creating a new one based on the given topology.
//-- Get the topology.
//Create a neural network with given topology.
//Get hidden topology
String [] sigHidden = sigNetNeurons.getText().split(",");
String [] scraw... | 7 |
public void Dijkstra(int startNode) {
System.out.println("Dijkestra's shortest path to all nodes");
Node[] S = new Node[size]; //All vertices for which we have computed the shortest distance
Node[] p = new Node[size]; //array of predecessors of v in the path s to v
PriorityQueue<Node... | 8 |
public void tetrisCommandMessage( String msg, ConnectionToClient client) throws IOException
{
if (msg.equals(""))
return;
//initialize local variables
String message[] = msg.split(" ");
String instruction = "";
String operand = "";
boolean hasWhiteSpace = false;
//Find if multipart mes... | 6 |
private static boolean encodeUnescaped(char c, boolean fullUri) {
if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')
|| ('0' <= c && c <= '9'))
{
return true;
}
if ("-_.!~*'()".indexOf(c) >= 0)
return true;
if (fullUri) {
return U... | 8 |
private int getColumnDataWidth(int column)
{
if (! isColumnDataIncluded) return 0;
int preferredWidth = 0;
int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, colum... | 3 |
public int[] twoSum(int[] numbers, int target) {
int[] two =new int[2];
Map<Integer,Integer> map = new HashMap<Integer,Integer>();
for (int i = 0 ; i < numbers.length; i++)
map.put(numbers[i],i);
for (int i = 0 ; i < numbers.length; i++){
if(map.get(target - numbe... | 4 |
public TreeSelectionEvent(JoeTree tree, int type) {
setTree(tree);
setType(type);
} | 0 |
public static ArrayList<Association> refineStepOne(
ArrayList<Association> associations) {
ArrayList<Association> temp = new ArrayList<Association>();
double newAvg = 0;
for (int i = 0; i < associations.size(); i++) {
Association current = associations.get(i);
DataPoint p = Global.DBSIMULATOR.get(current... | 8 |
@Override
public void actionPerformed(ActionEvent event) {
Component comp = getFocusOwner();
if (comp instanceof JTextComponent && comp.isEnabled()) {
JTextComponent textComp = (JTextComponent) comp;
ActionListener listener = textComp.getActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
i... | 5 |
@Override
public void caseAFalseHexp(AFalseHexp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(FalseLiteral");
inAFalseHexp(node);
if(node.getFalse() != null)
{
node.getFalse().apply(this);
}
outAFa... | 3 |
public static String reverseTranscribe(String inString) throws Exception
{
StringBuffer buff = new StringBuffer();
for ( int x= inString.length() - 1; x >=0; x-- )
{
char c = inString.charAt(x);
if ( c == 'A' )
buff.append( 'T' );
else if ( c == 'T' )
buff.append( 'A' );
else if ( c... | 7 |
public UnicodeFont getFont() {
if(unifont != null)
return unifont;
return defaultUnifont;
} | 1 |
double isSlightlyEqual(MembershipFunction mf, InnerOperatorset op) {
if(mf instanceof FuzzySingleton)
{ return op.slightly(isEqual( ((FuzzySingleton) mf).getValue())); }
if((mf instanceof OutputMembershipFunction) &&
((OutputMembershipFunction) mf).isDiscrete() ) {
double[][] val = ((OutputMembershi... | 9 |
public void visitSRStmt(final SRStmt stmt) {
print("aswrange array: ");
if (stmt.array() != null) {
stmt.array().visit(this);
}
print(" start: ");
if (stmt.start() != null) {
stmt.start().visit(this);
}
print(" end: ");
if (stmt.end() != null) {
stmt.end().visit(this);
}
println("");
} | 3 |
@Test
public void delMinReturnsValuesInCorrectOrderWhenInputIsGivenInAscendingOrder() {
int[] expected = new int[100];
for (int i = 0; i < 100; i++) {
h.insert(new Vertex(0, i));
expected[i] = i;
}
Arrays.sort(expected);
int[] actual = new int[100];
... | 2 |
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
int column = convertColumna(posX);
if (iniciaPartida && !movimiento) {
int fila = posicionLibre(column);
if (fila != -1) {
posYLibre = (fila + 1) * (2 * radio) + radi... | 9 |
public PlanAussendienst(JSONObject help, Object obj) throws FatalError {
super("Aussendienst");
if (isInt(obj)) {
dienst = new Aussendienst((Integer) obj);
} else {
try {
int difficult = help.getInt("Stufe");
int medicine = -1;
try {
medicine = help.getInt("Medizin");
} catch (JSON... | 3 |
static String stripEnding(String clazz) {
if (!clazz.endsWith(DEFAULT_ENDING)) {
return clazz;
}
int viewIndex = clazz.lastIndexOf(DEFAULT_ENDING);
return clazz.substring(0, viewIndex);
} | 1 |
@Override
public void onKeyPressed(char key, int keyCode, boolean coded)
{
// Tests the functions of the wavsound
if (!coded)
{
// On d plays the sound
if (key == 'd')
{
this.testtrack.play(null);
System.out.println("Plays a track");
}
// On e loops the sound
else if (key == 'e')
{
... | 7 |
public static long pop_intersect(long A[], long B[], int wordOffset, int numWords) {
// generated from pop_array via sed 's/A\[\([^]]*\)\]/\(A[\1] \& B[\1]\)/g'
int n = wordOffset + numWords;
long tot = 0, tot8 = 0;
long ones = 0, twos = 0, fours = 0;
int i;
for( i = wordOffset; i <= n - 8; i += 8 ) {
l... | 4 |
public void leaving(String name, Object o)
{
info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " leaving " + name + "()");
} | 0 |
private Solution findOptimum(ArrayList<Cockroach> cockroaches) {
Solution optimum = new Solution(cockroaches.get(0));
for (int i = 1; i < cockroaches.size(); ++i) {
Solution next = new Solution(cockroaches.get(1));
if (next.isBetterThan(optimum)) {
optimum = next... | 2 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public static Double resolver(ColaLigada<String> posfija) throws Exception{
Double a=0.0;
Double b=0.0;
Double c=0.0;
PilaLigada<Double> pila= new PilaLigada<>();
while(!posfija.vacia()){
String simbolo=posfija.pop();
switch (simbolo) {
... | 6 |
public Packer() {
super("Pack-U-Like");
saveChooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
return (f.getName().endsWith(".png"));
}
p... | 9 |
private void updateChartData() {
//
// Get the asset allocations
//
int[] types = SecurityRecord.getTypes();
double[] amounts = new double[types.length];
int rows = positionModel.getRowCount();
for (int row=0; row<rows; row++) {
SecurityRecord s = pos... | 8 |
public void method455(int time, int destY, int drawHeight, int destX) {
if (!aBoolean1579) {
double deltaX = destX - startX;
double deltaY = destY - startY;
double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
aDouble1585 = startX + deltaX * angle / dis... | 2 |
public int getMIPSRating()
{
int rating = 0;
switch (allocationPolicy_)
{
// Assuming all PEs in all Machine have same rating.
case ResourceCharacteristics.TIME_SHARED:
case ResourceCharacteristics.OTHER_POLICY_SAME_RATING:
rating = getMIPS... | 5 |
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n, m, c,testCase = 0;
while (true) {
n = sc.nextInt();
m = sc.nextInt();
c = sc.nextInt();
testCase++;
if (n == 0 && m == 0 && c == 0) {
b... | 9 |
public void useCharge() {
int[][] glory = {{1712, 1710, 3}, {1710, 1708, 2}, {1708, 1706, 1}, {1706, 1704, 1}};
for (int i = 0; i < glory.length; i++) {
if (c.itemUsing == glory[i][0]) {
if (c.isOperate) {
c.playerEquipment[c.playerAmulet] = glory[i][1];
} else {
c.getItems().deleteItem(glory[i... | 4 |
private static void createAndFillHuffmanTree(int[] header) throws IOException
{
huffmanTree = new GradProjectDataStruct();
for(int i = 0; i < header.length; i++)
if(header[i] != 0)
huffmanTree.insert(new Node(header[i], i));
huffmanTree.createHuffTree();
huffmanTree.fillHuffTab... | 2 |
public void updateTeacher(Teacher teacher)
{
PreparedStatement ps;
try {
if(teacher.getId() > 0)
{
ps = con.prepareStatement("UPDATE teacher SET name=?, value=? WHERE id=?");
ps.setInt(3, teacher.getId());
}
else
{
ps = con.prepareStatement("INSERT INTO teacher (name, value) VALUES (?, ?... | 2 |
public ProfileProperties verifyProfileKey(String key) {
String sql = "select * from app.profiles"+
" where key='"+key+"'";
ProfileProperties retVal = null;
if( dbConn != null ) {
try {
Connection conn = dbConn.getConnection();
Statement stmt = conn.createStatement();
ResultSet... | 4 |
public static void main(String[] args) {
for(int i=0; i<100; i++) {
char c = (char)(Math.random() * 26 + 'a');
System.out.print(c + ": ");
switch(c) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
System.out.println("vowel");
break;
case 'y':
case 'w':
System.out.println(... | 8 |
protected int whoIsWinner() {
if ( !haveAllPlayerFinished() ) {
return -1;
}
// eXgp : TODO
if ( true ) {
System.out.println("game!");
}
int winner = -1;
int scoreOfWinner = Integer.MIN_VALUE;
for ( int i=0; i<players.length; ++i ) {
if ( scoreOfWinner < players[i].getScore() ) {
if (... | 5 |
public void setScoreboardTitle(String scoreboardTitle) {
if(scoreboardTitle == null)
throw new NullPointerException();
scoreboardTitle = replaceColorCodes(scoreboardTitle);
this.scoreboardTitle = scoreboardTitle;
if(scoreboard != null)
objective.setDisplayName(scoreboardTitle);
} | 2 |
private static Object readNumber(final JsonReader data) throws JsonParseException {
StringBuilder result = new StringBuilder();
while(true) {
int c = data.read();
if(Character.isWhitespace(c) || c == '}' || c == ',' || c == ']' || c == '\0') {
data.skip(-1);
break;
}
if(c == -1) break;
result... | 8 |
public void changePosition(com.novativa.www.ws.streamsterapi.Position position) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_opera... | 3 |
public int countOccurrences(int target){
IntBTNode cursor = root;
int count = 0;
int nextElement;
if(root == null){
return 0;
}
while(cursor != null){
if(target < cursor.getData())
{
nextElement = cursor.getLeft().getData();
System.out.println("nex... | 4 |
public String fetchOption() {
if(!hasOptionArg()) {
throw new InputMismatchException("There is no option at the head of ArgSet.");
} else {
String s = pop();
return s.substring(2);
}
} | 1 |
private boolean differByTwoVerticalAndOneHorizontal(Field from, Field to) {
return Math.abs(from.distanceBetweenRank(to)) == 1 && Math.abs(from.distanceBetweenFile(to)) == 2;
} | 1 |
@Override
public void contextInitialized(ServletContextEvent arg0) {
if ((myDaemonThread == null) || (myDaemonThread.isAlive())) {
myDaemonThread = new DaemonThread();
myDaemonThread.start();
}
} | 2 |
private Cmds getCommand(String message) {
int begin = message.indexOf(' ') + 1;
int end = message.indexOf(' ', begin);
if(end == NOT_FOUND)
end = message.length();
String cmd = message.substring(begin, end);
if(cmd.equals("start"))
return Cmds.CMD_START_S... | 7 |
public static final void writeFile(File targetFile, String encoding, String[] fileContent) throws IOException {
FileOutputStream fos = null;
OutputStreamWriter osw = null;
BufferedWriter writer = null;
try {
fos = new FileOutputStream(targetFile);
osw = new OutputStreamWriter(fos, encoding);
writer = n... | 7 |
public static Highscore [] load(InputStream in)
throws IOException {
Vector highscores=new Vector(20,40);
InputStreamReader inr = new InputStreamReader(in);
String line;
while ( (line=jgame.impl.EngineLogic.readline(inr)) != null ) {
Vector fields = new Vector(5,10);
// XXX we use "`" to represent empty ... | 8 |
public String getBodyString() {
try {
if (body != null) {
return new String(body, "utf8");
} else {
return "";
}
} catch (UnsupportedEncodingException ignored) {
}
return "";
} | 2 |
public void iaComputeState(){
if(myIA.getAlert() && myIA.getTime()>0){
this.st = st.stalk;
}
else if(myIA.getHit()){
this.st = st.strike;
myIA.setHit(false);
myIA.actStnby();
}
else if(myIA.getStnby() && myIA.getTime()<2) {
... | 5 |
public void orderTicketToQueue(String ticketNo, String seatNum,
String token, String[] params, String date, String rangCode) {
HttpResponse response = null;
HttpPost httpPost = null;
try {
URIBuilder builder = new URIBuilder();
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
... | 9 |
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.