method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f49bfea4-a6fb-4015-8f55-a6eb803f1e5c | 3 | public int compare(Station s1, Station s2) {
if(s1.getPheromoneLevel() == s2.getPheromoneLevel()){
return 0;
} else if(s1.getPheromoneLevel() > s2.getPheromoneLevel()) {
return -1;
} else if(s1.getPheromoneLevel() < s2.getPheromoneLevel()) {
return 1;
}else{... |
ffb84073-6785-49b4-af1e-c614b57e3aad | 5 | public static void main(String[] args) {
String stringDNA = "TTTCAAGACCAGCCATACTTAAATCTACAGGGAAGAATAGACCGTACGACATAACTATAAAAGGACGGCCGCGAAGCGCCAACCTTATCCCGCGCGCCGCTTGTGCCAGTTCGAAAGGGTATGATTAGTCCCCCGGGAATCCAACGGTTAATGAACTAGAATCACTTGTTCATGGCGTGTTAGAGGCTTGGCCCTGCCGAAGCGTCCGGTAACAACACTTTCAATCCAAGATAGGCTACTTCAGAATTCCTGGTTGA... |
92e6f088-4d59-4ee0-9d6f-d4920e9f886d | 0 | public float getRadius() { return radius; } |
15a3a46e-86e9-4da6-9b47-506122152a9a | 9 | public final void run() {
anInt4472++;
for (;;) {
int i;
synchronized (this) {
for (;;) {
if (anIOException4474 != null) {
return;
}
if (anInt4470 < anInt4469) {
i = anInt4470 + -anInt4469 + anInt4475;
} else {
i = -anInt4469 + anInt4470;
}
if ((i ^ 0xffffff... |
f9d55608-5cfa-4d86-88dc-310a11410116 | 0 | public boolean getDuplicate(){
return this.duplicate;
} |
044b4a14-9884-4fc2-9e10-c88a21afd3ad | 2 | public Factory(int num) {
Resource res = Utils.myres(this.getClass());
this.neg = res.layer(Resource.negc);
this.num = num;
ArrayList<Tex> strands = new ArrayList<Tex>();
for(Resource.Image img : res.layers(Resource.imgc)) {
if(img.id != -1)
strands.add(img.tex());
}
this.stra... |
9e21ef3b-6255-457d-b9d0-a21c18bf46f9 | 2 | public Complex standardDeviation_as_Complex() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
Complex variance = Complex.zero();
Complex[] cc = this.getArray_as_Complex();
variance = Stat.... |
ad6e9b69-a0dc-47e0-b91e-653a1fc5a9f8 | 1 | public void showStudents(LinkedList<Student> students) {
final int size = students.size();
data = new Object[size][];
int i;
Iterator<Student> it = students.iterator();
Student t;
for (i = 0; it.hasNext(); ++i) {
t = it.next();
data[i] = new Object[] { t.no, t.name, t.age, t.sex, t.birthday,
t.a... |
c6aa8ea8-18f1-493c-b2dc-aa736c7e9764 | 1 | @Override
public void addNotify() {
super.addNotify();
if (thread == null) {
thread = new Thread(this);
thread.start();
}
addKeyListener(this);
} |
6cc2178b-acbb-45fe-b020-ec6fde54ee0b | 8 | public void run() {
repaint();
if(menu || sleepCounter > 0)
return;
if(sleepCounter == 0) {
HeliShooterMain.resetInstance();
TesterLedFramework.resetInstance().setModus(modus);
BoardSnake.resetInstance();
counter = 0;
}
if(modus >= 1 && modus <= 5 && ++counter % 3 == 0)
TesterLedF... |
8955478a-d955-4d9a-9228-1c01aae421c3 | 6 | public ListData() {
//These loop for a max of 100 items (shouldn't hit that high), a null return from Create###(); will end the loop.
for (int i=0; i<100 ;i++) {
Game.displayC.add(CreateCommander(i, 0, 0, false));
if (Game.displayC.get(i)==null) {
Game.displayC.remove(i);
break;
}
}
for (int i=... |
bd74626b-ec5d-4e80-98ac-d9cd5807c936 | 6 | public static void registerAuxiliaryMethod(MethodSlot method, Slot reason) {
if (method != null) {
{ Stella_Class renamed_Class = ((Stella_Class)(method.slotOwner.surrogateValue));
List auxiliarymethods = null;
if (renamed_Class != null) {
auxiliarymethods = renamed_Class.classAuxil... |
1e7f4ddd-5008-4eab-8063-235e95e3a41a | 8 | private void insert(int key, int clueKey, int ndj, VertexPulse v )
{
int pos = posCalculator(key, baseAproxBucket.getKey());
if(highLevelBuckets[pos] != null){
highLevelBuckets[pos].insertVertexTime(v);
}else{
AproxBucket theNewBucket = new AproxBucket(v, key, Delta);
highLevelBuckets[pos] = theNewBuck... |
8136fa1a-5dff-405a-939e-1342f8dae4f4 | 2 | @Override
public void draw(Graphics g, PositionTransformation pt, boolean highlight) {
// overwrite the draw method to change how the GUI represents this node
if(simpleDraw) {
super.draw(g, pt, highlight);
} else {
if(isDrawRound()) {
super.drawNodeAsDiskWithText(g, pt, highlight, Integer.toString(this... |
eda285f0-f843-4c85-bbb0-5cc86400ed20 | 0 | @Override
public void undo() {
node.setValue(oldText);
} |
a0ba526c-e402-454a-a54e-ce5320bda03d | 5 | public boolean equal( State other ){
if( other instanceof NaiveSudokuBoardState ){
NaiveSudokuBoardState other_state = (NaiveSudokuBoardState)other;
boolean flag = true;
for( int i=0; i<n && flag;i++){
for( int j=0;j<n && flag;j++){
flag = (board.get(i,j) == other_state.board... |
3c930735-80e7-4115-ba82-b5e549c86be2 | 4 | public boolean find(int value) {
System.out.println("happen " + this.value);
if (value == this.value) {
return true;
} else if (value > this.value) {
if (right == null)
return false;
return right.find(value);
} else {
if (left == null)
return false;
return left.find(value);
}
} |
6f549363-3d99-40b4-910e-75a87e68ec07 | 9 | private void drawMenu() {
int i = menuOffsetX;
int j = menuOffsetY;
int k = menuWidth;
int l = menuHeight + 1;//anInt952
//DrawingArea.drawPixels(height, menuOffsetY, menuOffsetX, color, width);
//DrawingArea.fillPixels(menuOffsetX, width, height, color, menuOffsetY);
//Border
DrawingArea.method338(men... |
865a13e8-c743-4276-9232-55b8090a60f6 | 3 | public boolean validateCard(Card card, int pinCode) throws NoCardInserted {
currentCard = card;
try {
validCard = !(currentCard.isBlocked());
if (!validCard){
throw new NoCardInserted();
} else {
validCard = currentCard.checkPin(pinCode);
if (!validCard)
throw new NoCardInserted();
}
} c... |
6e2dafab-138a-46d0-af86-e04408353023 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(plugin.prefix + "You have to be a player to use this command");
return true;
}
Player player = (Player) sender;
if(sender.hasPermission("N... |
8161af1f-c3c6-495c-b913-212f73548121 | 6 | int numOpenSets(Space space) {
int num = 0;
if (isOpen(board[space.pos[0]], space.piece, 1))
num++;
if (isOpen(getColumn(space.pos[1]), space.piece, 1))
num++;
if (space.diagID % 2 == 0
&& isOpen(topDownDiag(), space.piece, 1))
num++;
if (space.diagID % 3 == 0
&& isOpen(bottomUpDiag(), space.... |
2cd09457-f744-4a46-9eaf-39c1612bcbdb | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (this.preparate()) {
datacompiler = se.ReadXml(txtfilename.getSelectedItem().toString());
this.com = new Compilador(datacompiler, this.txtcad.getText());
this.co... |
54454382-ee0a-43b2-8f95-5cd5a3fdb9ef | 2 | public void fillDeck()
{
int z = 0;
for(int i = 0; i < 20; i++)
{
switch (z)
{
case 0: addCard(new passiveDefense()); z = 0; break;
}
}
} |
6b808beb-e007-4bcb-950c-0852b2b85007 | 2 | private boolean isMonitorExitSubRoutine(FlowBlock subRoutine,
LocalInfo local) {
if (transformSubRoutine(subRoutine.block)
&& getMonitorExitSlot(subRoutine.block) == local.getSlot())
return true;
return false;
} |
edf5f036-51ce-40f9-823c-935d138fe1a8 | 1 | private void init() {
// plugin enable stuff
if (getServer().getPluginManager().getPlugin("Vault") == null) {
getLogger().info("Vault is needed for this plugin!");
getServer().getPluginManager().disablePlugin(this);
}
setupPermissions();
setupChat();
//getServer().getPluginManager().registerEvents(thi... |
20201903-0e38-4bdc-809b-86498f385ac7 | 2 | private static String[] getInternalNames(final Type[] types) {
if (types == null) {
return null;
}
String[] names = new String[types.length];
for (int i = 0; i < names.length; ++i) {
names[i] = types[i].getInternalName();
}
return names;
} |
a1c8053d-25df-4824-82f9-1752bed2a25a | 6 | public long getSum(int limit) {
long time = System.currentTimeMillis();
long sum = 0;
int sqrt = 0;
boolean flag = false;
boolean[] primes = AtkinSieve.getPrimesBool(limit);
System.out.println(System.currentTimeMillis() - time);
for (int in = 1; in < limit; in++)... |
9e4f3b5b-8be9-43cc-8e6d-8ae866c10f16 | 2 | public void start() throws IOException {
System.out.println("Server Is Listening on port: " + port);
while (true) {
try {
RequestHandler requestHandler = new RequestHandler(serverSocket.accept());
pool.execute(new ConnectionHandler(requestHandler, port, directory));
} catch (IOExcep... |
6143d1f0-6a9c-411c-aefd-486b478456dc | 0 | public RemoveColumnHeaderRenderer() {
super("New");
} |
7b3ab14d-b47a-4370-a7a2-966f63a8c08b | 5 | public static String alarmClock( int day, boolean vacation )
{
if ( vacation )
{
return ( 1 <= day && day <= 5 ) ? "10:00" : "off";
}
return ( 1 <= day && day <= 5 ) ? "7:00" : "10:00";
} |
ecd42d1d-4a31-464b-a4be-87f9b4664ead | 3 | void subsample(int numberOfPoints) {
double xx[] = new double[numberOfPoints];
int count[] = new int[numberOfPoints];
double yy[] = new double[numberOfPoints];
for( int i = 0; i < x.length; i++ ) {
int j = i * numberOfPoints / x.length;
xx[j] += x[i];
yy[j] += y[i];
count[j]++;
}
for( int j = ... |
5028ba48-554a-428a-8dc9-a17fb25f1d80 | 5 | public static void showDatabase(String input) {
String[] sq = new String[database.size()];
database.toArray(sq);
int r = 0;
int[] ds = new int[sq.length];
for(String s : database) {
ds[r++] = mss(input, s, false);
}
for(int x = 0; x < sq.length; x++) {
for(int y = 1; y < sq.length; y++) {
if(ds[... |
f9d08327-889e-4773-b881-6631969b7e97 | 5 | public Dimension minimumLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
boolean ltr = target.getComponentOrientation().isLeftToRight();
Component c = null;
if ((c = getChild(EAST, ltr)) != null) {
Dimension d = c.getMinimumSize();
dim.wid... |
ae16f987-9ce5-4ddd-bd49-78c395177c35 | 4 | public void plug (IOThread io_thread_,
SessionBase session_)
{
assert (!plugged);
plugged = true;
// Connect to session object.
assert (session == null);
assert (session_ != null);
session = session_;
socket = session.get_soket ();
... |
8f0c1047-fd52-419d-ae8d-4a0c5bb84e73 | 4 | private void initGUI() {
try {
String iniPath = SBStringUtils.getAppPath("ini");
BoxLayout thisLayout = new BoxLayout(this.getContentPane(), javax.swing.BoxLayout.Y_AXIS);
this.getContentPane().setLayout(thisLayout);
{
aboutTabPanel = new JTabbedPane();
this.getContentPane().add(aboutTabPanel); ... |
348a26cf-2e14-4c71-936a-7aac98760d3d | 8 | public void testAll() throws IOException {
int sliceLength = 1000;
int maxSliceCount = 1000;
List<TestSet> sets = allSets(maxSliceCount, sliceLength);
Set<String> languages = identifier.getLanguages();
for (String language : languages) {
System.out.println(language);... |
fda671b9-4363-45b5-8f91-56708f67ece9 | 8 | public void doFFT(double [] xr, double [] xi, boolean invFlag) {
int n, n2, i, k, kn2, l, p;
double ang, s, c, tr, ti;
n2 = (n = (1 << bits)) / 2;
for (l = 0; l < bits; ++l) {
for (k = 0; k < n; k += n2) {
for (i = 0; i < n2; ++i, ++k) {
... |
36959dab-dac3-4a80-ad6e-3c6868e28cbc | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
be735f90-f5ba-4994-8f31-a852014695ed | 3 | public static HashMap<String,String> parseKeyValue(String msg){
if(isBlank(msg)){
return null;
}
String values = null;
try{
values = URLDecoder.decode(msg, CoderUtils.UTF8);
}catch(UnsupportedEncodingException e){
throw new UnsupportedCharset... |
32a77f85-44f0-474c-b0e9-8fb2a753f426 | 7 | private void pheneList()
{
ArrayList<Phene> list = new ArrayList<Phene>();
Phene[][] pgrid= new Phene[board.length][board[0].length];
for(int i=0; i<pgrid.length; i++)
{ for(int j=0; j<pgrid[0].length; j++)
{ pgrid[i][j] = new Phene(board[i][j].pheno); }
}
... |
ac932a90-26ee-4814-a93d-b4e74f059854 | 8 | private boolean _execRemoteApp(String application, boolean reset) {
String xmlString = null;
try {
URL url = new URL(HTTP_CAMERA_SERVER + HTTP_PATH_CONFIG + "?" + application);
xmlString = _readText(url.openStream()).trim();
Document document = _documentBuilder.parse(new InputSource(new StringReader(... |
6765fc20-ada3-468d-8d75-d5362012e5da | 3 | private MethodIdentifier findMethod(String name, String typeSig) {
for (Iterator i = methodIdents.iterator(); i.hasNext();) {
MethodIdentifier ident = (MethodIdentifier) i.next();
if (ident.getName().equals(name) && ident.getType().equals(typeSig))
return ident;
}
return null;
} |
ce875ebb-4493-4b9f-a28c-cfdfaf78f2f3 | 6 | private boolean validarDatos() {
//unicamente valido el numero de cuenta
boolean valido = false;
Validaciones val = new Validaciones();
if (jTextField1.getText().equals("") || jTextField2.getText().equals("")){
mensajeError("Ingrese un valor para Desde.. Hasta.");
... |
197e745f-6467-49ed-8ee1-2bc8d13f639f | 4 | public void refreshPanel() {
klasLijst.clear();
if (Sessie.getIngelogdeGebruiker().heeftPermissie(
PermissieHelper.permissies.get("BEHEERALLEKLASSEN"))) {
List<Klas> klassen = Dao.getInstance().getKlassen();
for (Klas klas : klassen) {
klasLijst.addElement(klas);
}
} else if (Sessie.getIngelogdeG... |
b974b8c8-bbe6-43e3-9b92-2d0266d49f58 | 3 | @Override
public void waitForConnection() throws NodeClosedException, InterruptedException {
synchronized (monitor) {
while (currentState.equals(State.OPENING) && !Thread.currentThread().isInterrupted())
monitor.wait();
if (currentState.equals(State.CONNECTED))
throw new NodeClosedException();
}
} |
711ef7d6-9c8d-4090-a047-bc0e4231196c | 4 | @Override
public void processEntity(Entity entity) {
Velocity velocity = entity.getComponent(Velocity.class);
Spatial spatial = entity.getComponent(Spatial.class);
switch (velocity.currentState) {
case Accelerate:
velocity.currentVelocity = Math.min(velocity.velocityCap, velocity.currentVelocity + veloci... |
3f459754-ee6b-49c4-af19-0c7be74f71b2 | 7 | @Override
public CompostType type() {
if (empty()) {
return CompostType.EMPTY;
}
final int bits = bits();
if (bits <= 32 || bits == NORMAL_STAGE[2]) {
return CompostType.NORMAL;
}
if (bits < 64 || bits == SUPER_STAGE[0] || bits == SUPER_STAGE[1] || bits == SUPER_STAGE[2]) {
return CompostType.S... |
5d00a538-82b7-4994-ab7b-cf2fd98e0ea9 | 0 | public void setCreationTime(long creationTime) {
this.creationTime = creationTime;
} |
39970494-75fe-4218-a6cf-37ff37acadc4 | 3 | synchronized public void writeFence(int flags, int len, byte[] data)
{
if (!cp.supportsFence)
throw new ErrorException("Server does not support fences");
if (len > 64)
throw new ErrorException("Fence payload too large");
if ((flags & ~fenceTypes.fenceFlagsSupported) != 0)
throw new Error... |
e6f1b38a-331f-48a2-a14a-7b718e980a84 | 2 | public void stop() {
if (!running) return;
running = false;
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
28ed21ad-1f52-4fd5-82bf-2cecb464cc41 | 1 | public void add(Boll boll) {
if(bollar != null)
bollar.p = boll;
boll.n = bollar;
bollar = boll;
} |
028158ef-0176-4973-96f0-59e0830f3605 | 0 | public boolean isIncoming() {
return _incoming;
} |
b9be4e96-f3e7-49cb-b39c-53a035b04166 | 9 | public void actionPerformed(ActionEvent event) {
if (event.getSource() == recommendUserBaseButton) {
recommendUserBased();
} else if (event.getSource() == similarUserButton) {
getSimilarUser();
} else if (event.getSource() == similarItemButton) {
getSimilarItem();
} else if (event.getSource() == recomm... |
01c718ad-ab0a-4be9-a6ea-361f06369123 | 5 | static final public void Type() throws ParseException {
if (jj_2_3(3)) {
ArrayType();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
BooleanType();
break;
case INTEGER:
IntegerType();
break;
case IDENTIFIER:
Identifier();
... |
0dd18cf2-9e08-426c-a852-6ec5d0f5701c | 5 | @Test
public void getSurplus() {
Trainer test = null;
Trainer test1 = null;
try {
test = new Trainer("Franz", 3);
test1 = new Trainer("Karl", 5);
} catch (Exception e) {
fail("Unexpected Exception");
}
try {
Trainer test3 = new Trainer("Sepp", 12);
} catch (ValueException e) {
// expected... |
78fdb367-378b-427b-982e-bd9ded90505c | 5 | public static List getContactList(){
List contactList = new ArrayList();
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("getContactList - addressBook returns null");
return null;
}
for(int i=0;i<addressBo... |
7f38490a-1d40-45c6-be95-250a7d75ae58 | 1 | private void resize(int n) {
Type[] newArray = (Type[]) new Object[n];
for (int i = 0; i < size; i++) {
newArray[i] = data[i];
}
data = newArray;
} |
b01e25df-a73a-48f3-9a92-1585a839adba | 1 | @Test
public void tanderivative_test() {
try{
double x = 2;
TanhCFunction tanh = new TanhCFunction(x);
double result= tanh.derivative(x);
double exp = 0.0026819013;
Assert.assertEquals(exp, result, 0.001);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemente... |
eddfa2de-466b-49c6-8279-0016717f488c | 6 | public void traceFramePartialTruth(Keyword lastmove, OutputStream stream) {
{ PartialMatchFrame self = this;
{ double weight = self.propositionWeight(self.controlFrame.proposition);
if (lastmove == Logic.KWD_DOWN) {
{ double cutoff = self.computeDynamicCutoff();
if (cutoff != ... |
ff735e6a-b8aa-4d0b-b003-69a6cf194c5e | 1 | public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
throw new RuntimeException(e);
}
AidyCalender var = new AidyCalender("万年历程序--Aidy");
} |
b51173c3-3b36-4d3a-9b10-c07a70c5ac95 | 7 | public void convertSound(File root) {
final File targetFolder = new File(root, "_generated/sound");
try {
Log.v("Converting SFX...");
final SoundConverter sc = createSFXEncoder();
Map<String, File> files = new HashMap<String, File>();
FileUtil.collectFiles(files, new File(root, "/_original/sound"), fa... |
4800f832-8969-4cfa-94f9-971903f77d87 | 1 | public static void updateLigneCommandeClient(int idlignecommandeclient, int idarticle,int idcommande,int quantite, Float prixht,Float prixttc,Float remise ) throws SQLException {
String query="";
try {
query = " UPDATE LIGNE_COMMANDE_CLIENT SET ID_ARTICLE=?,ID_COMMANDE=?,LIGQTE=... |
b3d26350-49a0-4ef6-a541-5f7bd0fa6f7b | 5 | public void calculate(double x)
{
if (lastCommand.equals("+"))
result += x;
else if (lastCommand.equals("-"))
result -= x;
else if (lastCommand.equals("*"))
result *= x;
else if (lastCommand.equals("/"))
result /= x;
else if (lastCommand.equals("="))
result = x;
display.setText("" + result);... |
7dc70c0d-f463-4431-80aa-fd07e0f3b00c | 3 | public boolean peutAttaquer(Territoire from, Territoire to) {
if (to.estAdjacent(from)) {
return true;
}
//else
return bonusPeutAttaquer(from, to) || (hasPower() && this.pouvoir.bonusPeutAttaquer(from, to));
} |
d71b4c00-d301-44cd-827b-cec56252509e | 1 | private static void run(InputStream in, ImageInfo imageInfo) {
imageInfo.setInput(in);
imageInfo.setDetermineImageNumber(true);
if (imageInfo.check()) {
System.out.println(
imageInfo.getFormatName() + ";" +
imageInfo.getMimeType() + ";" +
imageInfo.getWidth() + ";" +
imageInfo.getHeight() + ";"... |
142791e9-e12b-4ba1-8e70-4bcea07950a9 | 2 | public void setItems(String menu[]) {
for(int i = 0; i < items.length; i++) {
if(i < menu.length) { items[i] = menu[i]; }
else { items[i] = ""; }
}
} |
24c9aa97-ab68-42b4-99dc-1b8cbf029383 | 0 | public void setName(String value) {
this._name = value;
} |
e98fe780-d370-45db-baa9-87e07c740c78 | 9 | protected double connections(int x, int y) {
// 1 point for each Cell it adds to the available cells of the current
// color
double points = 4;
points = points + (player.getPieces().size() / 15) * 5;
// Extra points based on how many pieces you have left
if (player.getPieces().size() == 15) {
points = p... |
01946166-23c1-4a6a-ba2e-f8124ebc5fe5 | 7 | public void write(OutputStream out) throws Exception {
XMLElement tglbXML = new XMLElement("TOUCHGRAPH_LB");
tglbXML.setAttribute("version", "1.20");
final XMLElement nodeSet = new XMLElement("NODESET");
tglbXML.addChild(nodeSet);
TGForEa... |
60447a9b-abe9-46de-a9f8-15c0fb22b10e | 4 | @Override
public boolean equals(Object object) {
if (!super.equals(object)) {
return false;
} else {
NBTTagString nbttagstring = (NBTTagString) object;
return this.data == null && nbttagstring.data == null || this.data != null && this.data.equals(nbttagstring.dat... |
539fad38-1e22-481f-96b9-8da5eb441653 | 7 | private void advance() {
if (current.getChildren().isEmpty()) {
boolean foundNext = false;
while (!foundNext) {
currentLevel--;
// check for global finish
if (currentLevel == -1) {
return;
}
... |
1f674e38-335d-4a6b-a8ff-82d1b79c3a8c | 4 | @Override
public boolean equals(Object o)
{
if(o != null && o instanceof PortalServerInfo)
{
PortalServerInfo that = (PortalServerInfo)o;
return this.serverNetworkName.equals(that.serverNetworkName)
&& this.serverNetworkPort.equals(that.serverNetworkPort)
&& this.preferenceInfo == that.preferenceI... |
aaadfbcc-8aab-41b7-96c3-3aa94611ce1a | 1 | public String ALToString(ArrayList<Item> al) {
String str = "Start of toString()";
for (int i=0;i<al.size();i++) {
str += al.get(i).output();
str += "\n";
}
return str;
} |
acc638d7-da67-4c00-a9cf-05ad4d42d4f8 | 8 | private static void UnZip(String ZipName,long fileSize, JProgressBar progressCurr,JProgressBar progressBarTotal) throws PrivilegedActionException
{
String szZipFilePath;
String szExtractPath;
String path = (String)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public... |
761753bc-6806-42fc-9173-c335e7f6322f | 1 | public static synchronized EntityManagerFactory getInstance() {
if (singleton == null) {
singleton = Persistence.createEntityManagerFactory("GSB-2014-eq1_initialPU");
}
return singleton;
} |
28c6207c-bde2-4455-8904-cdc436cf5a64 | 2 | public Color getCityColor(Owner owner){
if(owner == Owner.Rom){
return romColor;
}else if(owner == Owner.Cathargo){
return cathargoColor;
}
return neutralColor;
} |
0218dd75-eab5-4fd9-bce8-3ecc197e00bf | 1 | public static void main(String[] args)
{
ArrayList list = new ArrayList();
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
list.add(new Integer(4));
list.add(new Integer(5));
Object[] in = list.toArray();
// Integer[] in = (Integer[])list.toArray();
/*
* 不能将Objec... |
564900ca-aeeb-4fe9-a5f4-c167ff56e658 | 1 | private boolean jj_3R_20() {
if (jj_3R_77()) return true;
return false;
} |
3153bebe-fa55-4691-a3a0-96dc8878661c | 7 | public String getRawResultOutput() {
StringBuffer result = new StringBuffer();
if (m_Classifier == null) {
return "<null> classifier";
}
result.append(toString());
result.append("Classifier model: \n"+m_Classifier.toString()+'\n');
// append the performance statistics
if (m_result !=... |
0aa71209-d195-49d0-9908-a1fb2af293ff | 2 | @Override
public void process() throws ServletException, IOException {
List<Product> productList = DataManager.getProducts();
Map<Categories, List<Product>> productMap = new HashMap<>();
for (Categories category : Categories.values()) {
productMap.put(category, new ArrayList<Pro... |
1e3419a3-9b4b-4a9e-8876-b77cedf3b08a | 6 | @Override
public void validate() {
if (sitename == null) {
addActionError("Please Enter Site Name");
}
if (siteurl == null && siteurl.equals("http://")) {
addActionError("Please Enter Web Site Url");
}
if (txtcolor == null) {
addActionE... |
ae00442a-0020-43c6-b7b4-e05d424f53dc | 7 | public int compareTo( Variant other )
{
if ( this.startIndex < other.startIndex )
return -1;
else if ( this.startIndex > other.startIndex )
return 1;
else if ( this.startOffset < other.startOffset )
return -1;
else if ( this.startOffset > other.startOffset )
return 1;
else if ( this.length < othe... |
a362c64c-50b5-4e60-8712-f8dd22b5a353 | 4 | private void write(String user, String event, int glID, String resName,
String status, double clock)
{
if (trace_flag == false) {
return;
}
// Write into a results file
FileWriter fwriter = null;
try
{
fwriter = new FileW... |
ac588822-2e9f-4221-94c9-d1e2e09432a0 | 5 | @Override
public GameUnit create(GameUnit.Type type) {
GameUnit gameUnit = new GameUnit();
switch (type) {
case Footman: {
gameUnit.setParams(4, 21, 2, 2);
gameUnit.setName("Пехотинец");
gameUnit.setImage(ImageHelper.getImage("footman.jpg"... |
00a47baa-fe5b-4b82-b2b7-38aa99db00e4 | 2 | public int getLevelByHash(String hash) {
for (int i = 1; i < numberOfLevels; i++) {
if (levelHashes[i].equals(hash)) {
return i;
}
}
return -1;
} |
3ab7af88-2857-44eb-9888-8bb252ba31c1 | 9 | public static boolean isValidThemeName(String value) {
for (int index = 0; index < value.length(); index++) {
char c = value.charAt(index);
if ((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
c == '_' ||
... |
d603be6e-0f01-46b3-b7a5-22d4ea19e9fd | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
97146b42-7dc4-435e-8a00-4f51f7190f3c | 5 | 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... |
364a8112-5f82-4910-bd09-6ffa315f6159 | 1 | public List findByExample(Record instance) {
log.debug("finding Record instance by example");
try {
List results = getSession().createCriteria(
"com.oj.hibernate.daoNdo.Record").add(
Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
re... |
c9b9d80d-3552-49fe-b051-6cd0650072fb | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Triangle other = (Triangle) obj;
if (i != other.i)
return false;
if (j != other.j)
return false;
if (k != other.k)
return false;
i... |
1c6fb152-cfd5-469e-920e-d12fcdf667e9 | 1 | public void sqlUpdate(String sql) {
try {
Statement stat = (Statement) conn.createStatement();
stat.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
a777f169-214f-4c9c-b79b-99d7c828502e | 2 | public String getText(String elementPath) {
String[] path = toPathArray(elementPath);
NodeList nodes = doc.getElementsByTagName(path[0]);
Element element = (Element)nodes.item(0);
for(int i=1; i < path.length; i++) {
if (element == null) return null;
nodes = element.getElements... |
1a793e47-2589-42b7-b6e1-8c23151f1434 | 2 | public String format (LogRecord logRecord) {
StringBuffer stringBuffer = new StringBuffer();
if (logRecord == null)
stringBuffer.append("null logRecord received by ConciseLoggingFormatter");
else if (logRecord.getMessage() == null)
stringBuffer.append("null logRecord message received by ConciseL... |
6d543a87-0a23-458e-b2ef-da99bb58dda8 | 8 | private Map<String, Element> createCCSSResults(DocBuilder report) {
Map<String, Element> results = new HashMap<>();
String sql = "SELECT "
+ " MSP.projectID "
+ ", MSP.siteID, BS.disname, BS.schname "
+ ", BC.gradeLevel "
+ ", BC.subjectA... |
3523204b-1c9a-4407-a53c-6a6fbae83edd | 3 | @Override
public Class<?> getColumnType(int columnIndex) throws IndexOutOfBoundsException {
if ((columnIndex < 0) || (columnIndex >= types.size())) {
throw new IndexOutOfBoundsException("getColumnType: IOOBE");
}
return types.get(columnIndex);
} |
43220bc8-bc8c-4c84-8336-c58b01881609 | 2 | public static void main(String[] args) {
TestBayes tb = new TestBayes();
ArrayList<ArrayList<String>> datas = null;
ArrayList<String> testT = null;
Bayes bayes = new Bayes();
try {
System.out.println("请输入训练数据");
datas = tb.readData();
while (tr... |
94987968-cd68-4dec-8c9d-ed6a98e917c1 | 4 | private static Icon _addIcon(String path) {
File file = new File(path);
Icon icon = icons.get(file.getName());
if (icon != null)
return icon;
if (!file.exists())
return null;
try {
icon = new ImageIcon(file.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
if (icon != null)
... |
5ec4f11a-a4b9-4a80-8bd5-30d725c0a59c | 0 | private static void fooMethod() {
Long num = null;
num.byteValue();
} |
cb1620fb-1de7-4e2b-b69b-9f509d34af2f | 7 | public static void createTrials() throws IncorrectNumberOfTrialsException {
if (Experiment.pp == null) {
System.err.println("Cannot create trials before participant is defined!");
} else {
int ssOffset = Experiment.pp.ssNb % CONDITION_MATRIX.length; //1 to 2
if (ssOffset == 0) {
ssOff... |
dff7c0ed-9cd5-4020-918b-f611ad8f72d6 | 3 | public static double calculateMatchPotential(User focus, User target, Set<Integer> questionSet)
{
//What answered correct
double pointsAcquired = 0;
double totalPossiblePoints = 0;
if(questionSet.size() <= 1)
return 0;
Iterator<Integer> i = questionSet.iterator();
while(i.hasNext())
{
int que... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.