method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a73cac07-12e3-4422-bc9a-f420f60d4368 | 6 | public static boolean isValid(ParsingTreeNode node) {
if ((node == null)
||(node.getSymbol() == null)) {
return false;
}
if (node.getSymbol() instanceof NonTerminal) {
if (node.hasChildren()) {
for (int i = 0; i < node.getChildrenCount(); i... |
1c01ef75-9e5d-4731-a4be-14dc3f582e1c | 2 | public boolean isFileNameUnique(String filename) {
for (int i = 0, limit = openDocuments.size(); i < limit; i++) {
if (PlatformCompatibility.areFilenamesEquivalent(filename, getDocument(i).getFileName())) {
return false;
}
}
return true;
} |
469d6879-94a4-4376-8f32-b76018db7c0c | 3 | public void levelCompleted() {
if ( level.targets == 0 ) {
long diff = (System.nanoTime() - start_time) / 1000000;
JOptionPane.showMessageDialog(Game.this,
"steps: " + steps + "\n" + diff + " ms.");
current_level++;
if ( current_l... |
53fe1542-ef13-4ebf-adfb-6586c2d5d149 | 2 | public void showNet() {
for (int i = 0; i < this.connection.length; i++) {
if (this.computers[i].isInfected()) {
System.out.println("PC № " + (++i) + " - is Infected");
i--;
} else {
System.out.println("PC № " + (++i) + " - is Safe");
... |
80820b55-52f5-4f40-88f5-3adceffcc8e2 | 2 | private Expression notStatement( List<Expression> args, String caller ) {
if ( args.size() != 1 ) {
System.err.println("not expected exactly one argument and got " + args.size() );
return new Void();
}
// returns the logical inverse
if ( args.get(0).show(defSubst,... |
0489bafc-64b9-4780-a9f9-465789ca85c0 | 2 | void extractBase(String b) {
String b2 = extract(b, "href");
if (b2 != null) {
try {
base = new URL(base, b2);
} catch (MalformedURLException e) {
// e.printStackTrace();
}
}
} |
6d5fbb35-8662-45e4-8d49-921a1badb454 | 8 | public ArrayList<ArrayList<Integer>> pathSumItr(TreeNode root, int sum) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
// DFS
ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
if (root == null)
return re... |
b488430a-aee9-4dd5-92d0-d2b3c50f00f5 | 7 | public void preprocess4LabelledLDA(boolean entire,char delimiter){
BufferedReader br = null;
BufferedWriter bw = null;
String inFile = this.homeFolder + "/"+ L_BUG_TOPIC_ENTIRE_NAME;
String outFile = this.homeFolder + "/" + L_BUG_TOPIC_FILE_NAME;
try{
if(!new File(inFile).exists()){
throw new Excepti... |
4a315515-deee-4cdd-982e-903bf3b86518 | 3 | @Override
public void apply(ImageView view, Study study) {
for(Image i : study.getImages()) {
BufferedImage origImg = i.getImageData();
BufferedImage img = new BufferedImage(origImg.getColorModel(), origImg.copyData(null), origImg.isAlphaPremultiplied(), null);
... |
107afec1-f2e5-45e2-8d68-ca398c08b885 | 0 | public int getTapeHead() {
return tapeHead;
} |
0ab85d41-2f1e-4293-b04a-da8ffe32d475 | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator<St... |
2aba35c9-b487-4d80-a28b-12fdc87a00e6 | 4 | final void removeSuccs() {
if (succs == null)
return;
if (succs instanceof Instruction[]) {
Instruction[] ss = (Instruction[]) succs;
for (int i = 0; i < ss.length; i++)
if (ss[i] != null)
ss[i].removePredecessor(this);
} else
((Instruction) succs).removePredecessor(this);
succs = null;
} |
008b5506-a7b0-4908-95e3-4f848d7faaf5 | 2 | public void stateUpdated(BasicPlayerEvent e) {
if(oldStatus != getStatus())
{
for (MusicPlayerListener listener : listeners) {
listener.statusChanged(getStatus());
}
oldStatus = getStatus();
}
} |
70fd5bf9-ed0c-419c-a94b-542bd6cbc039 | 3 | public Collection<GameObject> getObjectsOfType(Class<?> gameObjType) {
cleanDeadObjects();
ArrayList<GameObject> resultList = new ArrayList<GameObject>();
for (GameObject obj : this.getGameObjects()) {
if (gameObjType.isInstance(obj))
resultList.add(obj);
}
return resultList;
} |
251b26c6-65d5-439f-b3ab-41e389400310 | 7 | private static void equipItem() {
int heroChoice = 0;
int choice = 0;
String name = "";
while(choice != 4)
{
System.out.println("Please choose what hero you would like to change equipment on(Enter the hero number).\n"
+ "4). Or Exit.");
printHeroList();
try{
heroChoice = kb.nextInt();
... |
edad1f56-849b-4a44-867d-ad42e365c0e1 | 8 | private void updateGunHeading() {
if (currentCommands.getGunTurnRemaining() > 0) {
if (currentCommands.getGunTurnRemaining() < Rules.GUN_TURN_RATE_RADIANS) {
gunHeading += currentCommands.getGunTurnRemaining();
radarHeading += currentCommands.getGunTurnRemaining();
if (currentCommands.isAdjustRadarForG... |
0e3081e4-823e-4b5f-aa6b-ac1f64143ce0 | 7 | public void renderPreview(ShapeRenderer shapeRenderer) {
shapeRenderer.begin();
for (int side = 0; side < 6; ++side) {
if (side == 0) {
shapeRenderer.normal(0F, 1F, 0F);
}
if (side == 1) {
shapeRenderer.normal(0F, -1F, 0F);
... |
79b575bf-ae37-452c-9aa6-5a2ff6a3472a | 3 | public static void main(String[] args) {
if (DEBUGGING) {
// Display the command line args.
System.out.println("Starting with args:");
for (int i = 0; i < args.length; i++) {
System.out.println(i + ":" + args[i]);
}
}
// Get the... |
b52825d6-3379-4a67-9bfe-00254c6547ce | 3 | public void wordChars(int low, int hi) {
if (low < 0)
low = 0;
if (hi >= ctype.length)
hi = ctype.length - 1;
while (low <= hi)
ctype[low++] |= CT_ALPHA;
} |
f6d45152-c44b-4d8f-be9d-6c9c73637f19 | 9 | private static final String nameToID(final String mdName) {
if (Registry.SHA_HASH.equalsIgnoreCase(mdName)
|| Registry.SHA1_HASH.equalsIgnoreCase(mdName)
|| Registry.SHA160_HASH.equalsIgnoreCase(mdName)) {
return "0";
} else if (Registry.MD5_HASH.equalsIgnoreCase(mdName)) {
... |
253765b9-055b-44e6-9199-723af8f078e5 | 0 | public void execute() {
System.out.println("Called FirstStrategy.execute()");
} |
61545321-db65-4c91-85cb-940a5d74ae47 | 0 | public NormalDistribution(double mean,double standardDeviation, long SEED)
{
super(mean, standardDeviation,SEED);
//initialize the queue for output
q=new LinkedList();
this.SEED = SEED;
//getDistribution(0.5);
//getDistribution();
} |
63a0c3ff-7f18-49f1-944b-b5a4743d0673 | 8 | public void handleRequest(HttpRequest req) {
// TODO: handle the failed requests, returning error responses.
HttpRequestHeader hdr = (HttpRequestHeader) req.getHeader();
if (Cache.isCachable(hdr)) {
//proxy.logger.info("URL "+hdr.getURL()+" is cachable");
CachableHttpObject obj = proxy.cache.get(hdr);
i... |
28b536a1-1461-43bd-94b3-10e2c0f08112 | 5 | void print(Node t, int n, boolean p)
{
if (p)
{
this.ifFunc(t);
if (isFunc)
{
if (t.getCdr() != null)
{
t.getCar().print(-n, false);
System.out.println();
printDefine(t.ge... |
7758969c-cf2e-4682-9d3a-e543bfa7bb90 | 8 | public boolean isBlocked(Location loc1, Location loc2) {
int r1 = loc1.row;
int c1 = loc1.col;
int r2 = loc2.row;
int c2 = loc2.col;
int dx = r2 - r1;
int dy = c2 - c1;
// trivial move?
if ((dx == 0) && (dy == 0))
return false;
int mdx = Math.abs(dx);
int mdy = Math.abs(dy);
// cute test:
... |
476a3b53-04bb-4db3-b893-8122eea4f040 | 3 | protected Matrix add_(Matrix m, Matrix destination) {
if (!isSameLength(m))
throw new IndexOutOfBoundsException("mxn do not equal this matrix");
for (int i = 1; i <= this.m; i++) {
for (int j = 1; j <= this.n; j++) {
destination.insert(i, j, this.get(i, j) + m.get(i, j));
}
}
return destination;
} |
5dcc1e4f-e9e1-448f-b276-0ffee3787cdb | 0 | private void luoKomponentit(Container container) {
setPiirtoalusta(new Piirtoalusta(pelaaja,kamera));
container.add(piirtoalusta);
} |
975b34a5-9904-4ab9-8797-5ad09e387f2e | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
Person person = (Person) o;
if (age != person.age) return false;
if (!name.equals(person.name)) return false;
return true;
} |
517055c5-c6fd-44af-96d2-0494e9a29592 | 3 | protected void addMod() {
if(modsList.getSelectedValue()==null){
con.log("Log","please select a mod to add first");
}
else if(profileList.getSelectedValue()==null){
con.log("Log","please select a profile before adding a mod");
}else
{ //No problems, lets go
String str = modsList.getSelectedValue().t... |
490a0c06-8bfd-4f33-86ce-0e6395c9caed | 8 | private static String js_substring(Context cx, String target,
Object[] args)
{
int length = target.length();
double start = ScriptRuntime.toInteger(args, 0);
double end;
if (start < 0)
start = 0;
else if (start > length)
... |
58df3ffb-39dd-434e-8ff2-db3c447a3dba | 3 | public void setColumn(int y, String values) {
if (y < matrix[0].length && matrix.length == ((values.length() / 2) + 1)) {
for (int i = 0; i < matrix.length; i++) {
matrix[i][y] = Integer.parseInt(values.substring(i * 2, i * 2 + 1));
}
}
} |
05e842df-83f3-41ee-9061-ef5fb976b777 | 3 | private void generateMaze()
{
System.out.println();
System.out.println("Generating maze");
System.out.println("===============");
Stack<IMazeCell> cellStack = new Stack<IMazeCell>();
int visitedCells = 0;
IMazeCell currentCell = chooseOriginCell();
mazeStruc... |
e483b45f-a891-44a5-b680-33d856811d6c | 1 | @Override
public PeerReference replace(String failedPath, RepairIssue[] issues) {
Host[] failedHosts = new Host[issues.length];
for (int i = 0; i < issues.length; i++) {
failedHosts[i] = Deserializer.deserializeHost(issues[i].failedPeer);
}
Host localhost = delegate_.repl... |
4ddedfd2-d44a-4f0d-84a0-6c8daf8b007d | 1 | public void testWithTime_int_int_int() {
DateTime test = new DateTime(TEST_TIME1 - 12345L, BUDDHIST_UTC);
DateTime result = test.withTime(12, 24, 0, 0);
assertEquals(TEST_TIME1, result.getMillis());
assertEquals(BUDDHIST_UTC, result.getChronology());
test = new DateTime(... |
7d3e1bcb-f172-44af-b06f-e649d105a280 | 1 | @Override
public Data assembleOperand(List<String> operandParts) {
//All operand part arrays will contain 3 parts: label, DATA declaration, and operand value
String label = operandParts.get(0).substring(0, operandParts.get(0).length() -1); //Trim semicolon from label
lookupTable.put(label, operandAddressPointer)... |
a9dad919-9e80-4a2c-9514-3f0b92516706 | 0 | public void start() {
thread = new Thread(this);
thread.setName("Playback");
thread.start();
} |
d17273e5-666b-430f-b16b-287989fc8e2e | 3 | public Class getColumnClass(int columnIndex) {
// Devuelve la clase que hay en cada columna.
switch (columnIndex)
{
case 0:
// La columna cero contiene el pid del proceso, que es
// un Entero
return Integer.class;
case 1:
... |
82528194-50a7-4b3e-95ee-7cbfdcf3c547 | 0 | public void setStatus(String status) {
this.status = status;
} |
4fca83fa-83c1-4511-a52f-b37538616ded | 8 | private List<ICard> getSet(List<ICard> list) {
LinkedList<ICard> setList = new LinkedList<ICard>();
if (list.size() >= NUMBEROFSETCARDS) {
for (ICard cardOne : list) {
for (ICard cardTwo : list) {
if (!cardOne.equals(cardTwo)) {
for (ICard cardThree : list) {
if (proveIfIsASet(cardOne, ca... |
9c84e3e8-5347-4444-9608-53aa0eeee73c | 9 | private JLabel createPiece(int row, int col){
JLabel piece = new JLabel();
piece.setPreferredSize(new Dimension(50,50));
board_[7-row][col] = piece;
if (isManipulable_){
System.out.println("Panel has been added with InputListener");
piece.addMouseListener(new UserInputListener());
System.out.println("A... |
54d3140f-8996-4e56-a928-76d0358befbb | 6 | public void cargarListaBorrar(){
try{
r_con.Connection();
String puntoVenta=combo_pto_venta.getSelectedItem().toString();
ResultSet rs=r_con.Consultar("select tc_codigo,tc_descripcion,vxc_numero "
+ "... |
2d95c3fa-123c-47c9-9e25-5c01fe175082 | 8 | public static void main(String[] args){
mongoDB();
System.out.println("connected");
ArrayList<BasicDBObject> myList = new ArrayList<BasicDBObject>();
////////////////////////////////////////////////////
BasicDBObject query1 = new BasicDBObject("hashtags.text", "gameofthrones");
BasicDBObject query2 = new Ba... |
de918db3-4018-412c-8ebe-a8f1ae9856a4 | 3 | @Override
public int compareTo(Object arg0)
{
if (arg0 instanceof WeightedCellSorter)
{
if (weightedValue > ((WeightedCellSorter) arg0).weightedValue)
{
return 1;
}
else if (weightedValue < ((WeightedCellSorter) arg0).weightedValue)
{
return -1;
}
}
return 0;
} |
313b8260-b418-4fda-9a42-e833b886a107 | 0 | @Basic
@Column(name = "LOG_POS_ID")
public int getIdPos() {
return idPosLogEnt;
} |
8973b3f0-a9df-4ceb-91b7-2af1c412ecfc | 1 | private void PrintToFile(String output,String filename){
try
{
FileWriter fstream = new FileWriter(filename, true); //true tells to append data.
BufferedWriter out = new BufferedWriter(fstream);
out.write(output);
out.close();
}
catch (Exception e)
{
System.err.println("Error: " + e.get... |
004c6227-ce87-4439-90a6-f2559617a058 | 5 | @Override
public boolean truncate(String table) {
Statement statement = null;
String query = null;
try {
if (!this.isTable(table)) {
this.writeError("Table \"" + table + "\" does not exist.", true);
return false;
}
statement = connection.createStatement();
query = "DELETE FROM " + table + ";"... |
c55f79aa-5a30-4d31-8692-a451bb8b3475 | 1 | static long getIntLimit(final int factor)
{
if (factor >= LIMITS.length)
{
return 1;
}
else
{
return LIMITS[factor];
}
} |
ba685728-8615-4409-a95c-44e28c0acc3a | 1 | boolean setY(int y) {
if (y < height)
this.y = y;
return y < height;
} |
b01e1255-e11e-45d8-a550-dd44d37d6bf2 | 8 | private CommucObj doDistrDACSSlave(CommucObj cObj) {
long startTime = System.currentTimeMillis();
//boolean ligPresent = cObj.ligPresent;
//Setup the molecule system
Molecule m = new Molecule();
m = setupMolSystem(m,cObj.params,cObj.strandPresent,cObj.strandLimits);
RotamerSearch rs = (Rotam... |
48aa5d22-640c-4659-b712-37735daca481 | 5 | private static void lsonejob(String jobId, AbstractMap<String, JobStatus> jobStatusTbl) {
System.out.println("--------------------------------");
System.out.println("Job Name: " + jobStatusTbl.get(jobId).jobName);
System.out.println("Job ID: " + jobId);
System.out.println("Number of mapper tasks in total: " + ... |
3bad3e2d-b682-4f93-bd7e-7af873a9310e | 0 | public float getB() {
return b;
} |
b9fa3599-d3b0-4e07-b1ee-31ef936432fe | 9 | public Map<String, Object> toConfigurationNode() {
Map<String, Object> output = new LinkedHashMap<String, Object>();
output.put("group", group);
if (subgroups != null && subgroups.size() != 0) {
output.put("subgroups", subgroups);
}
if (permissions != null && permissions.size() != 0) {
Map<String, List<... |
6a324075-218b-4500-8af3-073e782f622c | 2 | private SelectionTransition findTransitionContaining(IWorkbenchPartReference activePart) {
for (SelectionTransition transition : transitions) {
if(transition.has(activePart)) {
return transition;
}
}
return null;
} |
3fab7451-813a-41df-8790-ea0f3e1c294b | 7 | public boolean terminateWrapperP() {
{ Wrapper self = this;
if ((self == Stella.NULL_LONG_INTEGER_WRAPPER) ||
((self == Stella.NULL_FLOAT_WRAPPER) ||
((self == Stella.NULL_STRING_WRAPPER) ||
((self == Stella.NULL_MUTABLE_STRING_WRAPPER) ||
((self == Stella.NULL_C... |
bb84f879-85dc-4cbc-b074-505393381ee8 | 8 | @SuppressWarnings("unchecked")
public AliasedMethodTable(Map<E, Double> elementsToWeight) {
if (requireNonNull(elementsToWeight, "elementsToWeight is null").size() == 0) {
throw new IllegalArgumentException("elementsToWeight is empty");
}
elements = (E[]) elementsToWeight.keySet(... |
8ea57254-bd34-435a-bf93-07e8ed9297a2 | 1 | public static String getFileNameFromPathName(String pathNameString) {
File file = new File (pathNameString) ;
if (file == null) {
return null ;
} else {
return file.getName() ;
} // end else
} // end method trimOffAnyFileExtension |
8d4f10a3-9784-4e84-bbf7-2eacfb6ea094 | 0 | public Socket getSocket() {
return serverSide;
} |
96fc9a3d-c1e0-4875-acef-1ba3d1ff76ab | 4 | public void loadBinaryProblem(String filename) {
String row;
ArrayList<Integer> classes = new ArrayList<Integer>();
ArrayList<FeatureNode []> examples = new ArrayList<FeatureNode []>();
try {
BufferedReader r = new BufferedReader(ne... |
50b12226-92b4-4f32-8051-3cd59c14c72c | 1 | public boolean setBossClass(String classname) {
HeroClass hc = hr.getClassManager().getClass(classname);
if (hc == null) {
return false;
}
this.bossclass = hc;
return true;
} |
c5f3f9ae-9fa3-43a8-8ceb-6f16b9d22024 | 0 | public String getCuenta() {
return cuenta;
} |
354a61b9-b000-413c-87a9-e4ceb047c6f8 | 1 | public static void executeSqlFile(String path) throws SQLException, IOException, ClassNotFoundException {
Class.forName("org.postgresql.Driver");
Connection connection = null;
connection = DriverManager.getConnection(
Configuration.getJdbcString(), Configuration.user, Configurati... |
13397d08-f0dd-49f6-b0b0-f4b0b20901ec | 6 | public static void main(String[] args) {
// TODO code application logic here
Scanner teclado = new Scanner(System.in);
System.out.println("Digite el # de impresiones que desea ver");
Ejercicio1 oEjercicio1=new Ejercicio1((Integer.parseInt(teclado.nextLine())));
System.out.print(o... |
261b43f3-cd44-4b28-94e0-94a3ee3b72b0 | 9 | public String getChildElementXML() {
StringBuilder buf = new StringBuilder();
buf.append("<query xmlns=\"http://jabber.org/protocol/bytestreams\"");
if (this.getType().equals(IQ.Type.SET)) {
if (getSessionID() != null)
buf.append(" sid=\"").append(getSessionID()).app... |
1963b996-538a-404e-a779-2d9dab3981e4 | 7 | private static boolean ArePermutations(long n1, long n2) {
char[] n1Chars = Long.toString(n1).toCharArray();
char[] n2Chars = Long.toString(n2).toCharArray();
if (n1Chars.length != n2Chars.length) {
return false;
}
for (int i = 0; i < n1Chars.length; i++) {
... |
4ae21a40-89d6-4ac5-839e-a8b4191a520a | 6 | public void drawBoard() {
String s = " ";
for (int i = 0; i < locations.length; i++) {
s += String.format("%2d", i);
}
s += "\n ";
for (int i = 0; i < locations.length; i++) {
s += " _";
}
s += "\n";
for (int y = 0; y < locations[0].length; y++) {
for (int x = 0; x < locations.length; x++) {
... |
ade872d3-3ffd-4b16-9066-be84e7d71244 | 4 | public String getRequestUncached(String path)
{
URL url;
StringBuilder content = new StringBuilder();
try
{
url = new URL(BaseURL + path);
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
String OAuth =
String.format
(
"OAuth oauth_token=\"%s\", oauth_client_id=\"%s\",... |
423481b4-902d-40e7-873c-58cd1862c6a0 | 3 | @Override
public String endSection(Marker marker) {
if (marker == null) {
return super.endSection(marker);
} else if (marker instanceof VcfEntry) {
// Ignore other markers (e.g. seqChanges)
if (vcfEntries != null) vcfEntries.add((VcfEntry) marker);
return super.endSection(marker);
}
return null;
} |
46c231a0-4b7f-4d50-8762-1b839a061c21 | 0 | public void quit() {
dispose();
} |
4c8f771b-c581-4dce-bd79-8e6af94b0378 | 6 | public AutocompleteJCBCategory() {
super();
setEditable(true);
Component c = getEditor().getEditorComponent();
if (c instanceof JTextComponent) {
final JTextComponent tc = (JTextComponent) c;
tc.getDocument().addDocumentListener(new DocumentListener() {
... |
ea0bc7d9-1be8-41e1-bf97-528291cf7d0f | 9 | @Override
public boolean equals( Object other ) {
if ( other == this ) {
return true;
}
if ( !( other instanceof TShortList ) ) return false;
if ( other instanceof TShortArrayList ) {
TShortArrayList that = ( TShortArrayList )other;
if ( that.size... |
eefd492d-4898-48fd-845f-b876386537a1 | 2 | public void setNative(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int mod = methodInfo.modifiers();
if (flag) {
mod |= Modifiers.NATIVE;
} else {
mod &= ~Modifiers.NATIV... |
5877160c-3bab-49ff-8069-ff35ac0c9171 | 5 | private void initialize() {
Ant initialAnt = null;
if (this.initialIndividual != null) {
initialAnt =
(Ant) new Ant(initialIndividual.getPersonWorkLists());
} else {
initialAnt = new Ant();
}
//other initializations
rand = new Random();
indexes = new int[subProjectNumber*s... |
7dfcf176-2f62-4129-9e32-5ed4b79047c8 | 9 | public void onPlayerChunkChange(ChunkyPlayer chunkyPlayer, ChunkyChunk toChunk, ChunkyChunk fromChunk) {
try {
if (Config.isDebugging()) {
Location loc = chunkyPlayer.getPlayer().getLocation();
//Logging.debug(chunkyPlayer.getName() + " x: " + loc.getX() + " z: " + l... |
dc87a4bb-d999-4f2f-a909-f6d376b751e2 | 3 | private void func_27332_a(int var1) {
if(13 == var1) {
this.field_27337_b = 0;
++this.field_27340_c;
this.field_27339_d = true;
} else {
if(10 == var1 && !this.field_27339_d) {
this.field_27337_b = 0;
++this.field_27340_c;
} else {
... |
8b5dc208-e374-482f-b024-417b166e3f99 | 0 | public void setName(String name) {
this.name = name;
} |
01598d91-2a64-4ff1-bbe0-73cdc08b4927 | 3 | void leftRotate(RedBlackNode x)
{
RedBlackNode y = x.right; // set y
x.right = y.left; // turn y's left subtree into x's right subtree
if(y.left != nil)
y.left.parent = x;
y.parent = x.parent; // link x's parent to y
if(x.parent == nil)
root = y;
else if (x == x.pare... |
682b2adb-ca0a-4898-8d90-80fc4d80e58e | 5 | @Override
public Boolean find(String login, String password) {
try {
connection = getConnection();
ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE Login=? AND password=?;");
ptmt.setString(1, login);
ptmt.setString(2, password);
resultSet... |
0736ba94-a26a-48b7-b497-c7ad0f8e18f0 | 8 | @Override
public void pushAround(Position pos, Map map) {
// TODO Auto-generated method stub
if (map.getMapEach(pos.x - 1, pos.y + 1) == 0) {
Position tempPos = new Position();
tempPos.x = pos.x - 1;
tempPos.y = pos.y + 1;
stack.push(tempPos);
}
if (map.getMapEach(pos.x - 1, pos.y) == 0) {
Po... |
44815c87-2186-4060-901d-66cc17bd5c36 | 5 | public static Collection<Document> parseLibraryTFIDF() throws FileNotFoundException {
Set<Document> result = new HashSet<Document>();
Map<String, Integer> docFrequency = new HashMap<String, Integer>();
for (String filename : LIBRARY){
Set<String> seenWords = new HashSet<String>();
String filePath = "data... |
ecdf3f7c-3bdf-46be-9664-1e7531645ea3 | 7 | protected void formDirectionList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
criteria.addParam(DAO_USER_LOGIN, user.getLogin());
ClientType ... |
309216a3-f031-4a92-baef-34d38430bfdc | 8 | protected void handleTOCEntry() throws IOException {
if (tocEntryLen == 0) {
if (tocEntryOffset >= BASE_ENTRY_LENGTH) {
if (getU16(0x00) != 0x4b50 || getU16(0x02) != 0x0201)
return;
tocEntryLen = BASE_ENTRY_LENGTH
+ getFileNameLength() + getU16(0x1e) + getU16(0x20);
if (tocEntryLen > t... |
fde63643-d4f3-4a9a-b964-bfff8bd745b9 | 5 | private List<String> getPID(String programName) throws IOException {
logger.detailedTrace("Obtaining PIDs for " + programName);
Process process = new ProcessBuilder("wmic", "Path", "win32_process", "Where",
commandLike(programName), "Get", "Caption,", "ProcessId").start();
Buffe... |
c6fbc29b-e223-4e03-8710-2602572e8c6a | 4 | private boolean checkCard(Scanner in)
{
System.out.println("Please enter your card information : ");
String inputBankID = in.next();
int inputCardID = Integer.parseInt(in.next());
currentCustomer = new CashCard(inputBankID, inputCardID);
if(inputBankID.equals(supportedBank.getBankID())
... |
8c466b10-dc2b-4120-8dc2-019130948b0f | 2 | private void reportProgress()
{
lastReport = Config.Now();
double perc = ((double)(reportTotal + reportNum) / (double)reportTarget) * 100;
if (perc > 100) perc = 100;
sendMessage(reportNum + " more chunks processed (" + (reportTotal + reportNum) + " total, ~" + Config.coord.format(perc) + "%" + ")");
reportT... |
e42f710c-1682-4e0e-837e-5d988a0bf494 | 0 | public void setValidator(Validator<T> validator) {
this.validator = validator;
} |
a2bbc6d1-6617-4c47-aa27-348b1ec7411f | 8 | public InetAddress getIP() {
InetAddress a = null;
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf
.getInetAddresses(); enumIpAddr.hasMoreE... |
7399c3b4-2822-4f4f-9825-2661f065d69d | 8 | public void updateTiles(Graphics g) {
for (int i = 0; i < Util.FULL_SIZE; i++) {
int y = i % Util.MAP_SIZE;
int x = i / Util.MAP_SIZE;
g.setColor(Color.BLACK);
if (tiles[i] == TileColor.SNAKE) {
g.setColor(Color.BLUE);
if(Snake.skipping)
g.setColor(Color.RED);
g.fillRect(x * Util.MAP_SIZE... |
b2b5df50-e9d1-4c1d-8427-cd6ef1e0161f | 4 | public void loadBank(){
orderDataAccesor dataAccessOrder=new orderDataAccesor();
List<bank> bankList=new ArrayList();
DefaultTableModel orderDataTable=new DefaultTableModel();
Object[ ] columnNames=new Object[4];
Object[ ] fieldValues=new Object[4];
//Patient m... |
6eb325e0-98aa-4ec8-b938-63fa8b01ff0a | 0 | public ConfigurationSelectionEvent(ConfigurationPane configurationPane) {
super(configurationPane);
} |
c2f50dd6-99f0-4de4-9482-a73b31abf9c1 | 9 | private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
// Check for closing frame
if (frame instanceof CloseWebSocketFrame) {
handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
return;
}
if (frame instanceof PingW... |
bfcf36d7-583e-4fae-b05d-fd0b803a216e | 5 | public void discoverChildren() {
int j=0;
for(int i=startIndex;i<list.length;i++) {
if(j>Gs.DisplayLimit) {
addChild(new GsMore(list,i,type));
break;
}
j++;
if(type.compareToIgnoreCase("songs")==0)
addChild(new GsPMSSong((GsSong)list[i]));
else if(type.compareToIgnoreCase("albums")==0)
... |
b99db5f3-40ca-4ba2-ba8b-8118763d3253 | 4 | private void read() throws IOException {
for (;;) {
if (decoder.decode(readBuffer)) {
return;
}
readBuffer.compact(); // go to write mode
final int numBytesRead = readChannel.read(readBuffer);
if (numBytesRead == 0) {
throw new IllegalStateException("Ready zero (0) bytes from channel");
}
... |
1fa94e4b-bcf6-4d34-aed6-964b9d8a697a | 4 | public List<Booking> getAllBookings() throws SQLException
{
try (Connection con = connector.getConnection())
{
String sql =
"select CourtBooking.*, [Member/Booking].MemberId"
+ " from CourtBooking"
+ " Left Join [Member/Booking]"
+ " on Co... |
b99efe64-9290-4563-ade0-34cc01a7858e | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
a93f1288-c77a-49ce-8194-1f0c9fbe68b6 | 9 | private void updateCurrentLogFile()
{
// get the log file name from the file system
File logFolder = new File(slateComponent.getLogDirectoryName());
File[] listOfLogFiles = logFolder.listFiles();
numLogFiles = listOfLogFiles.length;
if (numLogFiles == 0)
{
return;
}
if ((RotationParadigm.Boun... |
13d75b02-6280-4f10-98b5-86fa44455061 | 7 | public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
String JSONtext = "";
switch (command) {
case "chatmessage": // JTextField
try {
JSONtext = enc.encode(new Message(tg.chat.field.getText(),
tg.chat.userName));
tg.chat.field.setText("");
sendMessage(JSONtex... |
66075f06-7f76-455a-ae50-ea1a61eea796 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message1 = (Message) o;
if (date != null ? !date.equals(message1.date) : message1.date != null) return false;
if (message != null ? !me... |
9caae4bc-cc71-4829-88a9-8452e87292c8 | 6 | public void parseHCPout() {
in = new Scanner(System.in);
boolean success = false;
// Keep trying if file not found
while (!success) {
System.out.print("Awaiting NEOS output .txt file (or 000 to exit): ");
String NEOSfile = in.nextLine();
if (file.trim().equals("000")) {
System.out.println("Progra... |
2105417e-b1f2-4c12-b28e-aefd458f22f8 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.idUsuario == null && other.idUsuario !=... |
aaa95929-9263-4d1b-a231-1c620883d7f1 | 5 | public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals(ok.getActionCommand())){
if(singleNodePosition == null) try {
int num = Integer.parseInt(number.getText());
if(num <= 0){
throw new NumberFormatException();
}
AppConfig.getAppConfig().generateNodesDlgNumNodes =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.