method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e1cf9b51-ba74-4623-a82f-c626b2d2fa54 | 5 | public void startServer() {
boolean wasPaired;
try {
// Creates a server socket, bound to the specified port
this.serverSocket = new ServerSocket(this.port);
// Console
System.out.println("Listening on " + this.serverSocket);
// Loops forever,
// listening for client connection r... |
464e3c54-347f-44f6-bb78-627144ad1d84 | 1 | public boolean getLocalSideEffects(int paramNr) {
return globalSideEffects || localSideEffects.get(paramNr);
} |
d17c70dd-5644-4423-8bc9-f136a6edeb39 | 6 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
throws SlickException {
Input input = gc.getInput();
if (input.isKeyPressed(Input.KEY_1)) {
debug = !debug;
}
if (input.isKeyDown(Input.KEY_W)
&& Math.abs(body1.getVelocity().getY()) < 1) {
body1.addForce(new Vector2f(... |
2bb47455-9b08-4595-9d78-f0866ef0bc37 | 2 | public void paintOverlayMouseOver(Graphics g, int cornerRadius) {
switch(fPaintMode) {
case ALWAYS:
case MOUSE_OVER:
paintMouseOver(g, cornerRadius);
break;
default:
break;
}
fDecorator.paintOverlayMouseOver(g, cornerRadius);
} |
a64d6987-f8bd-40f4-9a36-f0df20c66e64 | 7 | static double incompleteBetaFraction1(double a, double b, double x) throws ArithmeticException {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, thresh;
int n;
k1 = a;
k2 = a + b;
k3 = a;
k4 = a + 1.0;
... |
5416f39d-0add-46e3-b2ed-31b937cc3d97 | 2 | public RosterAvailability checkAvailability (Date d) {
DateFormat df = new SimpleDateFormat("dd.MM.YYYY");
String refDate = df.format(d);
for (RosterAvailability r: rosterAvailability) {
String rDate = df.format(r.getDate());
if (refDate.equals(rDate))
return r;
}
return null;
} |
27d50846-498f-441e-91c5-cbb85ec7d1aa | 5 | int getFirstHit(int key, int maxValue) {
int bucket = key % buckets;
if(bucket < 0) {
bucket = -bucket;
}
int[] data = content[bucket];
if(data == null) {
return -1;
}
else {
int offset = data[0] * 2 - 1;
while(offset > 0) {
if(data[offset] == key && data[offset+1] <= maxValue) {
r... |
0feaa103-c7fe-4e0b-8408-83898aaba5a2 | 9 | public void setFilter()
{
try{
System.out.println("--------------------------------------------------------");
System.out.println("Hotel Ordering System - Set Filter");
System.out.println("--------------------------------------------------------");
System.out.println("1. ENTREE");
System.out.println("... |
9f754b5f-06f4-42b2-95bd-6a07da4ca68a | 7 | @Test
public void multiThreadedTest() throws InterruptedException {
final AtomicBoolean failed = new AtomicBoolean(false);
final AvgCounter c = new AvgCounter();
final AtomicLong index = new AtomicLong(0);
ArrayList<Thread> threads = new ArrayList<Thread>();
for (int i = 0; i < 10; i++) {
Thread t = new... |
af74aa0b-6e3a-48f7-a047-a979a9e11439 | 5 | public List<Weibo> startParse(String res) {
try {
JSONArray jsonArray = new JSONArray(res);
int size = jsonArray.length();
List<Weibo> list = new ArrayList<Weibo>(size);
for (int i = 0; i < size; i++) {
JSONObject object = jsonArray.getJSONObject(i);
Weibo weibo = parseToWeiboSina(object);
if ... |
2f781542-25c3-42fd-9392-2a05e5aed92d | 7 | public boolean addTag(String name, String appId, String userId)
{
//Tag validation and parameters checking
if(!validateTag(name))
return false;
if(appId == null || appId.equals(""))
return false;
if(userId == null || userId.equals(""))
return false;
try
{
String query = "SELECT ID F... |
b430dd7d-a391-4ea5-9350-fac1816f3e29 | 8 | public static void compileZipAssetsFile(String prjCompileDir, String prjGameName, String prjDir) {
File selectedFile = new File(prjCompileDir + File.separator + prjGameName.toLowerCase() + ".assets.zip");
File content = new File(prjDir);
File[] files = content.listFiles();
assert files !... |
0067003e-49f1-493e-85ab-b9178ee82ef2 | 0 | @Override
public void applyTemporaryToCurrent(){cur = tmp;} |
27e47c72-0daf-4d3a-911a-f0a026ac9024 | 6 | static final boolean method1849(char c) {
anInt6149++;
if (Character.isISOControl(c))
return false;
if (Npc.method2446(c, (byte) 105))
return true;
char[] cs = Class185.aCharArray2488;
for (int i_2_ = 0; cs.length > i_2_; i_2_++) {
int i_3_ = cs[i_2_];
if ((i_3_ ^ 0xffffffff) == (c ^ 0xffffffff... |
c3a87e3c-23f9-452a-b697-5191e36abe98 | 6 | @Override
public boolean canInsert() {
if (title == null) {
return false;
}
if (xCoordinate < 0) {
return false;
}
if (width < 0) {
return false;
}
if (helpHtml == null) {
return false;
}
if (colu... |
88f53a63-a846-4db9-a413-83481368a208 | 8 | private void sort(){
//(sort flags)
if(!channelsSorted && channels.length > 1){
Arrays.sort(channels, new Comparator<Object>() {
public int compare(Object a, Object b) {
if (a == FORCE) {
return -1;
} else if (b == FORCE) {
return 1;
... |
32fed3e2-44f4-4df4-aa3a-4b6429ca5b30 | 9 | public void makeMove() {
switch (getMoveNumber()) {
case 1:
move1(); break;
case 2:
move2(); break;
case 3:
move3(); break;
case 4:
move4(); break;
case 5:
move5(); break;
case 6:
move6(); break;
case 7:
move789(FieldSlot.CROSS, FieldSlot.CIRCLE); break;
case 8:
move789(FieldSl... |
8ae85fc4-d288-4dda-bcb5-dbb4db941a9d | 1 | public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
mv.visitLookupSwitchInsn(dflt, keys, labels);
if (constructor) {
popValue();
addBranches(dflt, labels);
}
} |
cc1f7bca-823d-4912-8e22-9ae596bc29a7 | 8 | public static boolean equalsArray(Class<?>[] a1, Class<?>[] a2) {
if (a1 == null || a2 == null || a1.length != a2.length)
return false;
for (int i = 0; i < a1.length; i++)
if (!a1[i].equals(a2[i]) && !a1[i].isAssignableFrom(a2[i]))
return false;
return true;
} |
f0b5b66b-04b3-47a6-b635-a809a77a06f8 | 8 | private final long method2802(int[] is, int i, boolean bool, int[] is_6_,
byte i_7_) {
try {
anInt6755++;
long[] ls = Class348_Sub40_Sub21.aLongArray9283;
long l = -1L;
l = (ls[(int) (0xffL & (l ^ (long) (i >> -134478552)))]
^ l >>> -612505656);
l = ls[(int) (0xffL & (l ^ (long) i))] ... |
94ee4fbf-297c-4cbf-8f70-2c699c39f426 | 2 | public static List<EntityMinecart> getMinecartsAt(World world, int i, int j, int k, float sensitivity) {
sensitivity = Math.min(sensitivity, 0.49f);
List entities = world.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox(i + sensitivity, j + sensitivity, k + sensitivity, i + 1 - s... |
1eb6a0ea-8124-49ed-b3bb-44e7343d5523 | 9 | public void completePlayerName()
{
Iterator var2;
GuiPlayerInfo var3;
if (this.field_50060_d)
{
this.inputField.func_50021_a(-1);
if (this.field_50067_h >= this.field_50068_i.size())
{
this.field_50067_h = 0;
}
... |
40d1170c-6637-41d9-a910-cbf686425044 | 3 | public String returnInsertColumnsName() {
StringBuilder sb = new StringBuilder();
List<String> list = columnMap.get(this.getClass());
int i = 0;
for (String column : list) {
if (isNull(column))
continue;
if (i++ != 0)
sb.append(',');
sb.append(column);
}
return sb.toString();
} |
728f0a40-eead-4b29-8d5e-859f05321edf | 4 | private boolean compareLSNToPageLSN(int lsn, int pageId) {
BufferedReader reader = null;
String[] line;
try
{
reader = new BufferedReader(new FileReader("page" + pageId));
line = reader.readLine().split("\\|");
} catch (FileNotFoundException e)
{
System.err.println("File >>page" + pageId + ">> do... |
814fd9a3-c37d-443b-9fb9-d7c5489691d2 | 0 | public void post(Message m) {
this.messages.add(m);
} |
642ac789-74fc-4b7b-86e5-05559d2f9144 | 1 | public ModelExecution() throws IOException {
OutputStragegy st = getOutput().getOutputStrategy(getName());
lastFolder = st.nextOutputFolder();
if (log.isLoggable(Level.CONFIG)) {
log.config("Simulation output folder: " + lastFolder);
}
lastFold... |
5acc2ba4-36c7-43bb-a59e-6debd167a581 | 1 | public static void main(String[] args) {
for (int i = 0; i < 10; ++i)
new Tank(i);
} |
e36ad0b0-31d6-4c0e-bbbe-5264bd5001e0 | 9 | public IJavaVersion getVersion(String version, boolean is64Bit) {
if (version == null || version.isEmpty() || version.equals("default")) {
return loadedVersions.get(null);
} else if (version.equals("64bit")) {
IJavaVersion best64BitVersion = getBest64BitVersion();
if ... |
ba984c1a-fdf6-4f70-b164-200a5503e0fe | 8 | public void setPriors(Instances train) throws Exception {
m_NoPriors = false;
if (!m_ClassIsNominal) {
m_NumTrainClassVals = 0;
m_TrainClassVals = null;
m_TrainClassWeights = null;
m_PriorEstimator = null;
m_MinTarget = Double.MAX_VALUE;
... |
5916112f-d6a8-4731-9f94-51da572211f9 | 0 | public Version getBrowserVersion() {
return this.browser.getVersion(this.userAgentString);
} |
12a405a9-0f25-430a-a63a-ad26f4955431 | 4 | public String getTable() {
Document elev_doc = null;
try {
elev_doc = Jsoup.connect(TABELL_ELEV_ADRESSE).data("id", "hidden").userAgent("Mozilla").cookie("auth", "token").timeout(3000).post();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Rompe... |
eafe2e29-5928-46ff-a3f8-9f5783a8eda8 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SchoolStudent that = (SchoolStudent) o;
if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) return false;
if (i... |
ff7bafe1-dd52-40c7-91b3-611d7e0a6736 | 6 | private static boolean b3(int i, int j, BufferedImage image) {
Boolean below = ((image.getRGB(i-1, j-1) == BLACK) ||
(image.getRGB(i , j-1) == BLACK) ||
(image.getRGB(i+1, j-1) == BLACK));
Boolean with = ((image.getRGB(i-1, j ) == WHITE) &&
... |
0b87e1ab-898c-4ec5-8980-d057db1c0de1 | 4 | public List<SplitMapperRealJvmCost> readRealMapperJvmCost(String dir) {
List<SplitMapperRealJvmCost> list = new ArrayList<SplitMapperRealJvmCost>();
File input = new File(dir);
try {
BufferedReader reader = new BufferedReader(new FileReader(input));
String[] title = reader.readLine().split("\t");
Stri... |
ec8eff05-e99b-4c56-ae6e-612cc7e46031 | 6 | public boolean hasValidPosition(){
if(y>=0 && y<=550 &&
x>=0 && x<=550 && (this.trajectory.x!=0 || this.trajectory.y!=0)){
return true;
}
return false;
} |
533145a8-df58-4ef6-b409-bc877e4069e6 | 7 | private final boolean method666(int i) {
anInt5421++;
if (((Class192) aClass192_5485).aBoolean2577)
return true;
if (((Class192) aClass192_5485).anInterface5_Impl2_2576 == null)
((Class192) aClass192_5485).anInterface5_Impl2_2576
= aHa_Sub3_5419.method3840(-28633, aBoolean5462);
Interface5_Impl2 interfa... |
290c3442-fa34-4d90-bcb0-13daf0143165 | 0 | public ConvertCFGLR(GrammarEnvironment environment) {
super("Convert CFG to PDA (LR)", null);
this.environment = environment;
} |
7213e9e3-d962-451a-ac77-897ce660d091 | 8 | public byte read() {
int value = 0;
if (I) value |= SREG_I_MASK;
if (T) value |= SREG_T_MASK;
if (H) value |= SREG_H_MASK;
if (S) value |= SREG_S_MASK;
if (V) value |= SREG_V_MASK;
if (N) value |= SREG_N_MASK;
if (Z) value |... |
30dde924-1a45-4286-b5c2-e1645e407aaf | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TipoLogradouro other = (TipoLogradouro) obj;
if (this.idTipoLogradouro != other.idTipoLogradouro && (this... |
93a8447a-e7c8-4c64-a294-0458746bedf9 | 9 | private void setNextTokens(int nextType, int[][] nextTokensPosition, TokenNext[][] nextTokens) {
switch (nextType) {
case 1:// the I token
setPositionForCase1(nextTokensPosition, 0);
break;
case 2:// the J token
setPositionForCase2(nextToke... |
e259e0eb-9558-4a7d-a807-96bf9708047a | 3 | private void connectSegToNode() {
for (Segment seg : segments) {
if (seg.getNodeID1() != null) {
seg.getNodeID1().addSegment(seg);
}
if (seg.getNodeID2() != null) {
seg.getNodeID2().addSegment(seg);
}
}
} |
f4cc88bb-b894-4cef-9cb4-11120fc91850 | 2 | public List<Credit> getCreditsByClientsId(int clientsId) {
//Создаем список кредитов
List<Credit> list = new ArrayList<Credit>();
try {
PreparedStatement statement = getConnection().prepareStatement(clientsIdQuery);
statement.setInt(1, clientsId);
ResultSet re... |
0e677f5e-5836-4df4-b1ca-d24acd5ecce9 | 5 | public void mousePressed(MouseEvent me)
{
if (this.isEnabled())
{
this.wasDragged = false;
sx = getImgXY(me.getX());
sy = getImgXY(me.getY());
selx = selection.x;
sely = selection.y;
if (tools.getSelectedDrawingTool() == Toolset... |
fc6812d1-a10c-48f1-a17f-cd33903bcaae | 1 | private String chooseFile() {
if (chooser.showDialog(org.analyse.main.Main.analyseFrame, null) == JFileChooser.APPROVE_OPTION) {
return chooser.getSelectedFile().getAbsolutePath();
}
return null;
} |
ba3e424e-4e50-4096-acd8-bbb63cc23815 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
6e751a39-fa7c-445d-a8d0-fb969f42ce3e | 4 | public int[] extractData (int start,int length) {
try {
int count=0,a=circBufferCounter+start;
int outData[]=new int[length];
if (a>=MAXCIRC) a=a-MAXCIRC;
for (count=0;count<length;count++) {
outData[count]=circDataBuffer[a];
a++;
if (a==MAXCIRC) a=0;
}
return outData;
}
catch (Excep... |
a2cc1f9c-38d3-419e-a93a-75d0ca1fe107 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Matricula other = (Matricula) obj;
if (this.id != other.id) {
return false;
}
... |
df53a1bd-b3ae-4070-875c-33093b19e061 | 5 | static private String getUnitFromAbrv(String t, String a){
int i=0;
Converter[] u;
if (t == "vol")
u = volUnits;
else if ( t == "pressure")
u = pressureUnits;
else // assume weight
u = weightUnits;
while (i < u.length
&& !u[i].abrv.equalsIgnoreCase(a)) {
i++;
}
if (i >= u.length)
re... |
29200ad2-f92c-4f82-9eee-43eabe872ce5 | 1 | private boolean jj_2_40(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_40(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(39, xla); }
} |
8cd787ca-91dd-48ac-88ef-a80e95b47392 | 9 | public NLIData readCache(String playername) {
final File file = new File(plugin.getDataFolder() + "/cache/" + playername + ".cache");
ArrayList<ItemStack> stacki = new ArrayList<ItemStack>();
ArrayList<ItemStack> stacka = new ArrayList<ItemStack>();
if (!file.exists()) {
NLIData nli = (this.plugin).new NLI... |
0459afad-5925-4f05-9826-90ab33f2f8fc | 9 | public boolean calculateFinalResult() {
double tempCost = 0;
do {
iStage++;
calculateAllocation();
tempCost = 0;
for (int i = 0; i < iClass; i++) {
for (int j = 0; j < iSite; j++) {
tempCost += dmDist[i][j] * dmPrediction[i][j]
* daPrice[j];
}
}
vCost.add(tempCost);
if (cal... |
9a848755-aee0-40e5-aa3d-eb78630ab7ee | 2 | public static List<AstronomicalObject> sortById(List stm, int factor) {
List<AstronomicalObject> sorted = stm;
if (factor < 0) {
Collections.sort(sorted, (B, A) -> ID_COMPARATOR.compare(A, B));
log.info("SortedByID descending :{}");
}
if (factor >= 0) {
... |
78652aa2-8d28-4953-b741-c2ea0e8ad955 | 5 | @Override
public void run() {
int fps = 0, updates = 0;
long fpsTimer = System.currentTimeMillis();
double nsPerUpdate = 1000000000.0 / 60;
double then = System.nanoTime();
double unprocessed = 0;
while (running) {
boolean shouldRender = false;
double now = System.nanoTime();
unprocessed += (now ... |
0bad830d-c28d-4982-8d9f-f9c195c668dc | 2 | private static URL getURL(String dir) throws MalformedURLException {
logger.info("URL not transformed: " + dir);
// check for Windows naming
if (dir.indexOf("\\") != -1) {
// Windows!
// 4 \ to obtain \\ in a regexp
dir = dir.replaceAll("\\\\", "/");
}
/* dir starts with file:, we... |
0b065b11-949b-4ced-9f13-f634c027e259 | 4 | public void remove(K key){
int location = (Math.abs(key.hashCode())%this.table.length);
LinkedList<TableData<K,V>> keys = (LinkedList<TableData<K,V>>)this.table[location];
Iterator<TableData<K,V>> i = new Iterator<TableData<K,V>>(keys);
while(i.hasNext()){
TableData<K,V> data... |
27f57934-5308-44bd-95b6-b722fd8f7494 | 9 | public static String driverClass(String url)
{
Validate.isTrue(isNotBlank(url));
if (url.contains(POSTGRESQL_FRAGMENT)) { return "org.postgresql.Driver"; }
if (url.contains(MYSQL_FRAGMENT)) { return "com.mysql.jdbc.Driver"; }
if (url.contains(HSQL_FRAGMENT)) { return "org.hsqldb.jdb... |
acec9b81-e62f-4461-af76-94512d90eba3 | 6 | public void changeLocation() {
switch(c.newLocation) {
case 1:
sendFrame99(2);
movePlayer(3578,9706,-1);
break;
case 2:
sendFrame99(2);
movePlayer(3568,9683,-1);
break;
case 3:
sendFrame99(2);
movePlayer(3557,9703,-1);
break;
case 4:
sendFrame99(2);
movePlayer(3556,9718,-1... |
fa09fafe-c3cb-4a5f-8dc7-412fdcf711ff | 4 | public void basicSetWorkout(Workout myWorkout) {
if (this.workout != myWorkout) {
if (myWorkout != null){
if (this.workout != myWorkout) {
Workout oldworkout = this.workout;
this.workout = myWorkout;
if (oldworkout != null)
oldworkout.unsetCardio();
}
}
}
} |
c9d2a6da-353b-4e79-b4e8-b6af4bed9743 | 0 | protected final DccChat dccAcceptChatRequest(String sourceNick, long address, int port) {
throw new RuntimeException("dccAcceptChatRequest is deprecated, please use onIncomingChatRequest");
} |
8e1ad8fd-4247-47b5-9e0d-198ca6f64262 | 5 | @Test
public void TestaaTyhjaVasenYlanurkkaOikeaAlanurkka() {
rakentaja = new Kartanrakentaja(10, 6);
char[][] kartta = rakentaja.getKartta();
Solmu aloitus = new Solmu(0, 0);
Solmu maali = new Solmu(kartta.length-1, kartta[0].length-1);
Reitinhaku haku = new Reitinhaku(kartt... |
b21477d8-388a-4b63-943b-da328403d64c | 3 | String compress(String input){
ArrayList<String> aList=new ArrayList<String> ();
int count=1;
int alphaCount=1;
StringBuffer sb=new StringBuffer();
String OrigalphaB=Character.toString(input.charAt(0));
String alphaB=OrigalphaB+alphaCount;
while(count<input.length()){
if(alphaB.equals(Char... |
5c9fba6a-3e24-484b-b5da-7fc493033f28 | 2 | public int getShorestPathLength(String from, String to) {
if (!actors.containsKey(from) || !actors.containsKey(to))
throw new Error("actor doesn't exist!");
ActorGraphNode fromActor = actors.get(from);
fromActor.setBaconNumbers(to);// BFS method
return actors.get(to).getBaconNumber();
} |
260a8442-75eb-423b-a7e1-b0905cbe63cb | 0 | public void setNick(String nick){ this.Nick = nick; } |
4aa09f2b-4acc-40d9-874e-e37ee09068d0 | 4 | public void updateAsScheduled(int numUpdates) {
super.updateAsScheduled(numUpdates) ;
if (numUpdates % 10 != 0) return ;
final float idealPop = idealNestPop(species, this, world, false) ;
final float inc = 10f / World.STANDARD_DAY_LENGTH ;
if (idealPopEstimate == -1) {
idealPopEstimate = ... |
ba2c0a4d-9d4b-4d5f-9390-daf56c3be1da | 9 | private void appendShapeInternal(StringBuilder sb) {
if (type == ShapeType.RECTANGLE && shield > 0) {
throw new UnsupportedOperationException();
} else if (type == ShapeType.RECTANGLE) {
sb.append("shape=rect");
} else if (type == ShapeType.OCTAGON) {
sb.append("shape=octagon");
} else if (type == Shap... |
6bfc50d9-c7d7-4a25-b3f3-1a97771a0fb8 | 5 | @Test
public void testSortingInterface() throws Exception
{
PersistenceManager pm = null;
if(driver != null)
{
pm = new PersistenceManager(driver, database, login, password);
}
else
{
//we're dealing with a 4.0 or better driver, omit driver specification.
pm = new PersistenceManager( database, lo... |
c94522a2-9f0d-4c3d-a31b-8cbba5f6c177 | 6 | @Override
public boolean setA(DenseMatrix64F A) {
_setA(A);
decomposition.setSingularThreshold(CommonOps.elementMaxAbs(A)* UtilEjml.EPS );
if( !decomposition.decompose(A) )
return false;
rank = decomposition.getRank();
R.reshape(numRows,numCols);
decom... |
d022603e-e7ad-4461-80da-e85934d6ad02 | 5 | private void configure() throws IOException {
//Load the properties file
Properties properties = new Properties();
// Read the properties file
properties.load(this.getClass().getResourceAsStream("/com/opendap/poc/ServerContentDownloader.properties"));
useProxy = Boolean.parseBoolean(properties.getProperty("... |
357569c6-83da-44b8-9b3c-4564e40846bd | 8 | public DependencyStructure parse(String[] tokens) throws MaltChainedException {
if (!initialized) {
throw new MaltChainedException("No parser model has been initialized. Please use the method initializeParserModel() before invoking this method.");
}
if (tokens == null || tokens.length == 0) {
throw new Malt... |
291accd1-f48e-47e4-ba09-7187ffb8c607 | 1 | public City getCityByID(int id){
if(containsID(id)){
return cityMap.get(id);
}
return null;
} |
6c883d70-1d6b-495a-9e96-88cc2e0e8d5f | 2 | public boolean contains(String s)
{
for(int i =0; i<numStrings; i++)
{
if(strings[i].equalsIgnoreCase(s))
{
return true;
}
}
return false;
} |
011c1765-7b53-42d2-8060-3295b710a3e5 | 3 | private boolean checkValid15() {
if ((inChar7[0]==false)&&(inChar7[6]==true)&&(bcount>=7)) return true;
else return false;
} |
1651d143-bc36-470a-be05-17f6a74ae16f | 5 | public void drawBoard(Graphics g) {
Board board = frame.getBoard();
for (int i = 0; i < 11; i++) {
for (int j = 0; j < 11; j++) {
if (board.isValidHex(i, j)) {
drawHex(g, board, i, j);
}
}
}
if (frame.isGameOver()) {
int winner = frame.getWinner();
g.setColor(Color.BLACK);
String res... |
4076814e-bf85-4fb5-91db-a7f96b979175 | 4 | private int getArgumentCount(TokenOperator token) {
int argCount = 0;
String original = token.getOriginal();
if (original.equals("*")) {
argCount = 2;
} else if (original.equals("/")) {
argCount = 2;
} else if (original.equals("+")) {
argCount = 2;
} else if (original.equals("-")) {
argCount = ... |
c7672fcd-67c4-4991-bc10-bc2d91cea9ac | 8 | private Node put(Node node, Key k, Value v) {
if (node == null) {
return new Node(k, v, 1, RED);
}
if (node.key.compareTo(k) > 0) {
node.left = put(node.left, k, v);
} else {
node.right = put(node.right, k, v);
}
if (isRed(node.right) &... |
0e062133-d098-4040-95b9-b44a8c890fa4 | 8 | public void putPastAndRank(String[] nameArray, int[] maxCount,
StringBuilder sb) throws IOException {
long time = System.currentTimeMillis();
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Entity past = null;
try {
past = datastore
.get(KeyFactory.createKey("past_str... |
c87f9914-b918-4017-8d57-9c534c93fcc5 | 9 | @Override
public void run() {
if (file == null) {
logger.fatal("file is null!");
return;
}
logger.debug("Watching " + file.getAbsolutePath());
switch (state) {
case NEW:
state = State.DELETED;
fileWatcherService.offer(new JFileWatcherEvent(JFileWatcherEvent.Code.NE... |
b9e9b7d6-b13b-4f47-a9d5-7199997d24f4 | 2 | @Override
public Book findBook(String title) {
// TODO Auto-generated method stub
for (Book book : fdb.getBooks()) {
if (book.getTitle().equals(title)){
return book;
}
}
return null;
} |
68694326-1acd-41c2-8184-0e96fb79745e | 8 | public static boolean checkAnagrams(String s1, String s2) {
if (s1 == null || s2 == null || (s1.length() != s2.length()) || s1.length() == 0) {
return false;
}
int[] charCount = new int[256];
for (int i=0;i<256;i++) {
charCount[i] = 0;
}
char[] str1chars = s1.toCharArray();
char[] str2chars = s2.toC... |
0ab441a1-f3f1-45cb-b7f7-d695ad39d23f | 4 | public boolean isNearlyUpperHessenberg(double tolerance){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(j<(i+1) && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false;
}
}
... |
293c1f4f-d9ec-4d48-8075-338866660695 | 4 | public SokobanEditor() {
frame = new JFrame("Editor");
menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
menuFile = new JMenu("Datei");
menuBar.add(menuFile);
/**
* File New
*/
menuFileNew = new JMenuItem("Neu");
menuFile.add(menuFileNew);
menuFileNew.addActionListener(new ActionListener(... |
3d95b6f3-8586-4ed5-af38-b437db26231e | 5 | public void drawLayer(Graphics g, int grid_size, boolean connected, int gx, int gy) {
if (displayable) {
for (int i = 0; i < gx; i++) {
for (int j = 0; j < gy; j++) {
if (colorArr[i][j] != null) {
g.setColor(colorArr[i][j]);
... |
58c3a0c1-451b-4855-aa43-5a681ac3cd3b | 4 | public ArrayList<ForecastObject> getForecast() throws SQLException{
QueryBuilder qb = new QueryBuilder();
Date date = new Date(); // Current date & time
long maxTimeNoUpdate = 3600; // Maximum one hour with no update
ArrayList<ForecastObject> forecastFromDB = new ArrayList();
... |
6d664eb9-23db-4440-8150-31bb001a222e | 7 | private void rebuild() {
removeAll();
setLayout(new GridLayout(0, 1));
JButton addSpellBookButton = new JButton("Add New Spellbook");
addSpellBookButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
... |
9348dc6b-df6d-45d0-87f3-265e88085a5a | 7 | public void actionPerformed(ActionEvent e)
{
if (e.getSource().equals(edit))
{
if(RecipeListPanel.recipeSelected == null)
JOptionPane.showMessageDialog(null, "You currently have no recipe "
+ "selected. Please select a recipe and try again");
... |
7b7c00c5-3c6f-49fa-8c7c-3046be309cc5 | 7 | public void advanceY(Direction direction) {
if(limitToScreenBounds) {
if(direction == Direction.UP) {
if((this.y - speed) < 0) {
// Prevent movement, object is at min screen bounds
return;
}
} else if(direction == Direction.DOWN) {
if((this.y + speed) > (this.panelHeight - this.height)) {
... |
89ae1491-3392-4409-be55-5b3d00fc837d | 3 | @Test
public void testOutput() throws Exception {
List<String> list = new List<>();
list.addToEnd("test1");
list.addToEnd("test2");
list.addToEnd("test3");
int elementCount = 0;
for (String current : list) {
if (list.exist(current)) {
eleme... |
9d515e45-5b29-4aa4-b51f-c6294bb08765 | 7 | public String[] getBestGuess(String subCmd){
tempArray.clear();
String[] bestGuess = new String[NUM_SUGGESTIONS];
for(int i = 0; i<latexDictionary.size();i++)
{
if(subCmd.length()<=latexDictionary.get(i).length()){
if(latexDictionary.get(i).substring(0, subCmd.length()).equals(subCmd)){
tempArray.ad... |
69a99b04-dda4-4c46-90c2-25a49f0bfc05 | 1 | @Override
public void mouseReleased(MouseEvent e) {
if (pressedKeyCode == 17) // ctrl key
{
newPosition = e.getPoint();
drawMapComponent.dragNDropZoom(oldPosition.getX(), oldPosition.getY(), newPosition.getX(), newPosition.getY());
}
drawMapComponent.drawRecta... |
689707f0-96ec-4ad9-b5ca-68a9c991437e | 1 | public void notifySimulationListeners() {
for (ISimulationListener l : listeners) {
l.simulationCycleComputed();
}
} |
84458453-f83b-4f25-b2b9-6ae2b16d9a3f | 7 | public static LinkedHashMap sortProperties (Properties p) {
Properties oldProps = new Properties();
Enumeration e = p.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String score = p.getProperty(key);
oldProps.setProperty... |
021bcdf7-1cab-4d0e-bb1a-62e2cd95b10f | 8 | protected void onReadAction()
{
int read;
boolean closed;
boolean readMore = true;
int readBufferSize = getReadBufferSize();
ByteBuffer buffer = getByteBuffers().acquire(readBufferSize, false);
try
{
// The buffer can be smaller than the data avail... |
2e2e8321-3837-4c83-aaaa-f4fc5b8cadc3 | 8 | public static void main(String[] args)
{
String path = "";
try
{
String classpath = ClassLoader.getSystemClassLoader().getResource(".").getPath();
path = URLDecoder.decode(classpath, "UTF-8");
}
catch (UnsupportedEncodingException e1) {}
Logger.createLog(path);
Logger.log(Level.INFO, "R... |
da89a7ea-aefc-4c84-92a4-8b935caee65f | 0 | public String getAccountName() {
return this.accountName;
} |
e8b7c2cd-41ac-4bd9-83e9-b7902fb62122 | 5 | public void mousePressed(MouseEvent e)
{
x1 = e.getX(); // store where mouse is when clicked
y1 = e.getY();
if (!e.isPopupTrigger() && mode == Mode.NONE) // left click and
{ // not in a special mode
int newsel = getSelected(x1, y1); // find shape mouse is
if(selindex>=0)
... |
9a7277b3-2c24-490d-9e63-6cb33b7ba04a | 2 | @Override
public List<Ingredient> getChildrenIngredients(Ingredient c){
List<Ingredient> children = new ArrayList<Ingredient>();
for(Ingredient cat : ingredientRepository){
if(cat.getParentIngredients().contains(c.getIngredientId())){
children.add(cat);
}
}
return children;
} |
d61930dc-4e55-42fb-a727-035b609d182b | 6 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
Object temp=request.getAttribute("Data");
Class c = temp.getClass();
String className=c.getName();
if (className.compareTo("java.util.LinkedList")==0){ //Dea... |
9b0aa1c8-e3be-425e-9545-215be5bc0d5e | 1 | public boolean pushOperand(final Block block) {
final Boolean flag = (Boolean) saveOperand.get(block);
return (flag != null) && flag.booleanValue();
} |
f3178b32-7eb3-44af-9796-b470ddadad36 | 2 | protected Map<Integer, UserData> persistInterests(List<Interest> objects, Map<Integer, UserData> users) throws Exception {
for (Interest row : objects) {
if (!users.containsKey(row.id)) {
throw new Exception("The user is not readed yet");
}
UserData user = use... |
59a46994-a680-4bfb-80cd-4c9a4f0ae051 | 5 | private void vendreEntrada()
{
List<Integer> jornades = taquillerService.consultarJornadesDisponibles();
int jornada = readint("Introdueixi el identificador de la jornada: ");
if ( !jornades.contains(jornada) )
{
System.out.println("La jornada [" + jorna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.