method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
90ea6568-af83-407c-8a1e-10eb6f2ab873 | 3 | public V valAt(Class c) {
V val = lookup.valAt(c);
if (val == null) {
val = checkBaseClasses(c);
}
if (val == null) {
val = checkBaseInterfaces(c);
}
if (val == null) {
val = lookup.valAt((Class) Object.class);
}
return val;
} |
c1695f7c-a074-471b-98f5-98d88a05a446 | 2 | public FastqBuilder withQuality(final String quality) {
if( quality == null ) { throw new IllegalArgumentException("quality must not be null"); }
if( this.quality == null ) {
this.quality = new StringBuilder(quality.length());
}
this.quality.replace(0, this.quality.length(), quality);
return this;
} |
b0eea7a8-1fa3-4063-9193-fbc78682523d | 2 | protected void die() {
super.die();
int count = random.nextInt(2) + 1;
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.slime), x + random.nextInt(11) - 5, y + random.nextInt(11) - 5));
}
if (level.player != null) {
level.player.score += 25*lvl;
}
} |
2ff5fb18-0e82-4392-a80b-07e4738d3088 | 1 | public final void initUI() {
JMenuBar menubar = new JMenuBar();
JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
JMenu view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
JCheckBoxMenuItem sbar = new JCheckBoxMenuItem("Show StatuBar");
sbar.setState(true);
sbar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (statusbar.isVisible()) {
statusbar.setVisible(false);
} else {
statusbar.setVisible(true);
}
}
});
view.add(sbar);
menubar.add(file);
menubar.add(view);
setJMenuBar(menubar);
statusbar = new JLabel(" Statusbar");
statusbar.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
add(statusbar, BorderLayout.SOUTH);
setTitle("JCheckBoxMenuItem");
setSize(360, 250);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
} |
fff14fc9-7f91-4ff4-863d-721c5718b7a3 | 5 | public static void divideString(String str){
char[] carr = str.toCharArray();
int len = carr.length;
for( int i=0; i< len-1; i++){
char chari = carr[i];
char nextc = carr[i+1];
if( isDigit( chari)){
stack.push( char2int(chari) );
}else if(isOp(chari)){
Op op = new Op();
op.left = stack.peek();
op.op = chari;
op.right = char2int(nextc);
ops.add(op);
}
if(i==len-2&& i!=0){
stack.push( char2int(nextc));
}
}
return;
} |
e1e45e20-3aaf-4c96-ab43-2e4858ea76a7 | 0 | @Override
public PermissionType getType() {
return PermissionType.ENTITY;
} |
62715f6f-1f07-4c34-8f85-41cef92237fa | 8 | public static void main(String[] args) {
try{
File directory = new File("/Users/bhaveshkumar/mygit/java-class-enumerator/folder");
System.out.println("Test class location: " );
List<Class<?>> classes = ClassEnumeratorFindAll.processDirectory(directory);
System.out.println("Number of classes found in directory file: "+classes.size());
Class<?>[] expected = new Class<?>[] {
pro.ddopson.ClassEnumerator.class,
pro.ddopson.ClassEnumeratorFindAll.class,
test.ClassIShouldFindOne.class,
test.ClassIShouldFindTwo.class,
test.subpkg.ClassIShouldFindThree.class,
TestClassEnumeration.class,
TestClassEnumerationFindAll.class
};
for (Class<?> clazz : expected) {
if (!classes.contains(clazz)) {
System.out.println("FAIL: expected to find class '" + clazz.getName() + "'");
System.exit(-1);
}
}
if(classes.size() != expected.length) {
System.out.println("FAIL: expected to find " + expected.length + " classes, but actually found " + classes.size());
System.exit(-1);
}
}catch(Exception ex){
System.out.println("Exception occured"+ex);
}
} |
985ff321-6bf0-4245-8a17-c3b10157d2c4 | 6 | private void attackPlaceAbove(int position, char[] boardElements, int dimension) {
if (isPossibleToPlaceOnPreviousLine(positionAboveRight(position, dimension))
&& isPositionInRangeOnTheRight(position, dimension)
&& isBoardElementEmpty(boardElements[positionAboveRight(position, dimension)])) {
boardElements[positionAboveRight(position, dimension)] = FIELD_UNDER_ATTACK_CHAR;
}
if (isPossibleToPlaceOnPreviousLine(positionAboveLeft(position, dimension))
&& isPositionInRangeOnTheLeft(position, dimension)
&& isBoardElementEmpty(boardElements[positionAboveLeft(position, dimension)])) {
boardElements[positionAboveLeft(position, dimension)] = FIELD_UNDER_ATTACK_CHAR;
}
} |
5e9962c0-d3a5-4cc2-9e1f-171f773579da | 5 | @Override
public int loop() {
if (stop) {
shutdown();
}
if (validate() && !wait) {
final Node stateNode = scriptTree.state();
if (stateNode != null) {
scriptTree.set(stateNode);
final Node setNode = scriptTree.get();
if (setNode != null) {
getContainer().submit(setNode);
setNode.join();
}
}
}
return Random.nextInt(80, 101);
} |
a8cab8f0-4561-4ed4-ba83-84346814d792 | 2 | public void setKeyFrameTo(String name) {
for (KeyFrame k : keys) {
if (k.equalsIgnoreCase(name)) {
currentKey = k;
break;
}
}
} |
26703532-22fc-40e4-85f3-b318ceb2bcc7 | 2 | private static void fourthStrategy()
{
Semaphore MReading = new Semaphore(1);
Semaphore MWriting = new Semaphore(1);
Semaphore MPrio = new Semaphore(1);
Semaphore MPrioW = new Semaphore(1);
Semaphore MPrioR = new Semaphore(1);
int RCounter = 0;
int WCounter = 0;
Random r = new Random();
while(true)
{
if(r.nextDouble() > 0.5)
new Lecteur3(MReading,MWriting,MPrio,MPrioR, RCounter).run();
else
new Redacteur3(MWriting,MReading, MPrioW, WCounter).run();
}
} |
6789d32f-2dea-4600-908c-e1e340f5a5d9 | 4 | void select_imagesource_file_dialog() {
String fname = null;
JFileChooser chooser = new JFileChooser(image_dir);
chooser.setDialogTitle("Open Image File");
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f.exists()) {
fname = f.toString();
image_file = f;
image_dir = f.getParent();
} else
statusBar.setText("file does not exist");
}
if (fname != null) {
//String json;
try {
//json = new String(Files.readAllBytes(Paths.get(fname)));
//Gson gson = new Gson();
//ImageSource source = gson.fromJson(json, ImageSource.class);
ImageSource source = new ImageSource(fname);
updateImageSource(source);
} catch (Exception e1) {
System.err.println("Error getting " + fname + ": " + e1);
}
}
} |
2104027f-d13b-4078-a5e0-92f28299ab3a | 1 | public void draw(Graphics g) {
for (int i=0; i < edges.size(); i++) {
edges.get(i).draw(g);
}
} |
1a9d5d0a-c848-467e-b23c-e2d56adb370f | 4 | public static long getJailExpire(String playerName){
long expire = 0;
if(isJailed(playerName)){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'");
// This loop checks all bans on record for the user to see if any tempbans are still active
// Note tempbans are done in DAYS, the argument is a Double
// For example 0.5 would be 0.5(1 day)=12hours
// .1 -> 2.4 hours
// 7 = 7 days, etc.
while (SQL_RESULTSET.next()) {
if(SQL_RESULTSET.getLong("expire") > System.currentTimeMillis()){
expire = SQL_RESULTSET.getLong("expire");
}
}
SQL_RESULTSET.close();
SQL_STATEMENT.close();
} catch(SQLException e){
e.printStackTrace();
}
}
return expire;
} |
3fed0592-de53-4d72-8d1f-b06cc08c66bc | 5 | public void findScalarProduct() throws IOException {
int totalInputs = Integer.parseInt(fileReader.nextLine());
int input=1;
List<Integer> arrayOne;
List<Integer> arrayTwo;
while(fileReader.hasNext()){
int totalNumberOfElements = Integer.parseInt(fileReader.nextLine());
arrayOne = new ArrayList<Integer>();
arrayTwo = new ArrayList<Integer>();
StringTokenizer arrayOneTokenizer = new StringTokenizer(fileReader.nextLine());
StringTokenizer arrayTwoTokenizer = new StringTokenizer(fileReader.nextLine());
for(int i=0;i<totalNumberOfElements;i++){
arrayOne.add(Integer.valueOf(arrayOneTokenizer.nextToken()));
arrayTwo.add(Integer.valueOf(arrayTwoTokenizer.nextToken()));
}
int crossProductSum = 0;
for(int i=0;i<totalNumberOfElements;i++)
for(int j=0;j<totalNumberOfElements;j++)
crossProductSum+=arrayOne.get(i)*arrayTwo.get(j);
if(input==totalInputs)
fileWriter.append("Case #"+input+": "+crossProductSum);
else
fileWriter.append("Case #"+input+": "+crossProductSum+"\n");
input++;
}
fileReader.close();
fileWriter.close();
} |
09f9b38d-f19d-4d2f-8991-353ec8de344f | 2 | public byte[] Int32ToByte4(Integer value) {
byte[] result = new byte[4];
/*** forward algorithm [123][0][0][0] ***/
byte i = 0, j = 0;
while(true) {
result[j] = (byte)((value >> (i*8)) & 0xff);
if (j == 3) break;
j++;
i++;
}
return result;
/*** inverse algorithm 0 0 0 123 ***
byte tmpI = 3;
int tmpJ = 0;
while(true) {
tmpResult[tmpJ] = (byte)((aInteger >> (tmpI*8)) & 0xff);
if (tmpJ == 3) break;
tmpJ++;
tmpI--;
}
return tmpResult;
***************************/
} |
3f419884-e991-4589-83d4-5f62c8977f41 | 6 | private void subtraction(int countryCode, int numberToMinus){
if(IPCTrackerKeys.DEBUG_STATUS){
logger.log(CLASS_NAME, "DEBUG: Minus");
}
switch(countryCode){
case IPCTrackerKeys.CountryCodes.SU:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from SU");
int currentTotalSU = Integer.parseInt(lblTotalSU.getText().substring(7 , lblTotalSU.getText().length()));
int newTotalSU = currentTotalSU - numberToMinus;
tfSU.setText("");
taSU.append("\n-" + numberToMinus);
lblTotalSU.setText(IPCTrackerKeys.Strings.Total + newTotalSU);
break;
case IPCTrackerKeys.CountryCodes.Ger:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from Ger");
int currentTotalGer = Integer.parseInt(lblTotalGer.getText().substring(7 , lblTotalGer.getText().length()));
int newTotalGer = currentTotalGer - numberToMinus;
tfGer.setText("");
taGer.append("\n-" + numberToMinus);
lblTotalGer.setText(IPCTrackerKeys.Strings.Total + newTotalGer);
break;
case IPCTrackerKeys.CountryCodes.UK:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from UK");
int currentTotalUK = Integer.parseInt(lblTotalUK.getText().substring(7 , lblTotalUK.getText().length()));
int newTotalUK = currentTotalUK - numberToMinus;
tfUK.setText("");
taUK.append("\n-" + numberToMinus);
lblTotalUK.setText(IPCTrackerKeys.Strings.Total + newTotalUK);
break;
case IPCTrackerKeys.CountryCodes.Jap:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from Jap");
int currentTotalJap = Integer.parseInt(lblTotalJap.getText().substring(7 , lblTotalJap.getText().length()));
int newTotalJap = currentTotalJap - numberToMinus;
tfJap.setText("");
taJap.append("\n-" + numberToMinus);
lblTotalJap.setText(IPCTrackerKeys.Strings.Total + newTotalJap);
break;
case IPCTrackerKeys.CountryCodes.US:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from US");
int currentTotalUS = Integer.parseInt(lblTotalUS.getText().substring(7 , lblTotalUS.getText().length()));
int newTotalUS = currentTotalUS - numberToMinus;
tfUS.setText("");
taUS.append("\n-" + numberToMinus);
lblTotalUS.setText(IPCTrackerKeys.Strings.Total + newTotalUS);
break;
default:
logger.log(CLASS_NAME, "Country Code: \"" + countryCode + "\" does not exist.");
break;
}
} |
998887c2-c5ba-4496-b802-205139494298 | 3 | public void deleteElement(String value) throws NotExist{
ListElement previous = head;
ListElement current = head.next();
if (previous.getValue().equals(value)) {
head = head.next();
count--;
} else {
while (current != tail.next()) {
if (current.getValue().equals(value)) {
ListElement help = current.next();
previous.connectNext(help);
previous = help;
current = help.next();
count--;
} else {
previous = current;
current = current.next();
}
}
}
} |
9a5f6995-24aa-4833-99a4-0c80ba69eab6 | 0 | public String getRegip() {
return this.regip;
} |
962240fa-b821-482b-9a7d-d643c2cdda17 | 9 | public void setQueue1(FloatQueue t) throws MismatchException {
if (t == null)
throw new NullPointerException("the arg cannot be null");
if (q2 != null) {
if (t.getLength() != q2.getLength())
throw new MismatchException("queue 1 and 2 have different lengths!");
if (t.getPointer() != q2.getPointer())
throw new MismatchException("queue 1 and 2 have different pointer indices!");
if (t.getInterval() != q2.getInterval())
throw new MismatchException("queue 1 and 2 have different intervals!");
}
if (q3 != null) {
if (t.getLength() != q3.getLength())
throw new MismatchException("queue 1 and 3 have different lengths!");
if (t.getPointer() != q3.getPointer())
throw new MismatchException("queue 1 and 3 have different pointer indices!");
if (t.getInterval() != q3.getInterval())
throw new MismatchException("queue 1 and 3 have different intervals!");
}
q1 = t;
} |
918d3b20-3b50-483a-99ff-187ce6f5fa3d | 5 | public ArrayList<ArrayList<ArrayList<String>>> erstelleBlockelementListRegular(
ArrayList<Umlaufplan> umlaufplanliste, Fahrplan fahrplan) {
ArrayList<ArrayList<ArrayList<String>>> ListPlaeneGesamt = new ArrayList<ArrayList<ArrayList<String>>>();
int zaehler = 0;
ArrayList<Blockelement> blockelementlist = new ArrayList<Blockelement>();
for (int i = 0; i < umlaufplanliste.size(); i++) {
ArrayList<ArrayList<String>> ListPlan = new ArrayList<ArrayList<String>>();
blockelementlist = regelmaessigeBlockelement(
umlaufplanliste.get(i), fahrplan);
zaehler = 0;
for (int j = 0; j < umlaufplanliste.get(i).getUmlauf().size(); j++) {
ArrayList<String> serviceJourneyList = new ArrayList<String>();
for (int j2 = zaehler; j2 < blockelementlist.size(); j2++) {
Integer blockID = umlaufplanliste.get(i).getUmlauf().get(j)
.getId();
if (blockelementlist.get(j2).getBlockID() == blockID) {
serviceJourneyList.add(blockelementlist.get(j2)
.getServiceJourneyID());
zaehler++;
if (zaehler == blockelementlist.size()) {
ListPlan.add(serviceJourneyList);
}
} else {
ListPlan.add(serviceJourneyList);
break;
}
}
}
ListPlaeneGesamt.add(ListPlan);
}
return ListPlaeneGesamt;
} |
ece457ec-fff7-4688-94bd-fff8bbca79f7 | 8 | public static void render(Graphics g){
Graphics2D g2d = (Graphics2D) g;
if (screen == 0) {
g2d.setColor(Color.WHITE);
g2d.setFont(new Font("Serif", Font.BOLD, 96));
g.drawString("Jomapat", Jomapat.game.getWidth() / 2 - 170, 100);
g2d.setFont(new Font("Serif", Font.BOLD, 36));
g2d.drawString(selection == 0 ? "> START" : " START", Jomapat.game.getWidth() / 2 - 100, Jomapat.game.getHeight() / 2 + 50);
g2d.drawString(selection == 1 ? "> HELP" : " HELP", Jomapat.game.getWidth() / 2 - 100, Jomapat.game.getHeight() / 2 + 100);
g2d.drawString(selection == 2 ? "> ABOUT" : " ABOUT", Jomapat.game.getWidth() / 2 - 100, Jomapat.game.getHeight() / 2 + 150);
g2d.drawString(selection == 3 ? "> EXIT" : " EXIT", Jomapat.game.getWidth() / 2 - 100, Jomapat.game.getHeight() / 2 + 200);
g2d.setColor(new Color(0.5f, 0.5f, 0.8f, 0.3f));
g2d.fillRect(Jomapat.game.getWidth() / 2 - 120, Jomapat.game.getHeight() / 2, 200, 220);
for (int i = 0; i < BlockType.values().length; i++) {
BlockType b = BlockType.values()[i];
g2d.drawImage(b.getSprite(0), 0, i * 64, null);
g2d.drawImage(b.getSprite(0), Jomapat.game.getWidth() - 64, i * 64, null);
}
} else if (screen == 1) {
g2d.setColor(Color.WHITE);
g2d.setFont(new Font("Serif", Font.BOLD, 48));
g.drawString("Move using WASD", 50, 120);
g.drawString("Break using Leftclick", 50, 220);
g.drawString("Build using Rightclick", 50, 320);
} else if (screen == 2) {
g2d.setColor(Color.WHITE);
g2d.setFont(new Font("Serif", Font.BOLD, 64));
g.drawString("'Jomapat' is a Game.", 50, 120);
g2d.setFont(new Font("courier", Font.BOLD, 20));
g.drawString("Programming :", 50, 250);
g2d.setFont(new Font("courier",0, 20));
g.drawString("Joshua 'inplex'", 50, 300);
g.drawString("Matthias 'matthinc'", 50, 330);
g2d.setFont(new Font("courier", Font.BOLD, 20));
g.drawString("Graphics :", 50, 390);
g2d.setFont(new Font("courier",0, 20));
g.drawString("Patrick 'om22'", 50, 440);
g.drawString("www.github.com/inplex/jomapat", 50, 500);
g2d.setFont(new Font("arial", 0, 12));
}
} |
49f99877-1989-4125-b7e2-98b7802ae82a | 0 | public void setBlogContent(String blogContent) {
this.blogContent = blogContent;
} |
96d30735-589c-4094-8b5d-a2def7541f4b | 2 | private static Properties Configure() {
Properties prop = new Properties();
InputStream in = null;
try {
in = new FileInputStream(getDefaultConfigPath() + "jmpd.properties");
prop.load(in);
} catch (FileNotFoundException e) {
System.out.println("[INFO] No user configuration. Creating new file");
createConfig();
} catch (IOException e) {
} finally {
}
return prop;
} |
55533bcf-30e8-408b-9136-6b93a61defa3 | 9 | public void mate(Chromosome father, Chromosome offspring1,
Chromosome offspring2) {
int geneLength = getGenes().length;
int cutpoint1 = (int) (Math.random() * (geneLength - getGeneticAlgorithm()
.getCutLength()));
int cutpoint2 = cutpoint1 + getGeneticAlgorithm().getCutLength();
Set<Double> taken1 = new HashSet<Double>();
Set<Double> taken2 = new HashSet<Double>();
for (int i = 0; i < geneLength; i++) {
if ((i < cutpoint1) || (i > cutpoint2)) {
} else {
offspring1.setGene(i, father.getGene(i));
offspring2.setGene(i, getGene(i));
taken1.add(offspring1.getGene(i));
taken2.add(offspring2.getGene(i));
}
}
for (int i = 0; i < geneLength; i++) {
if ((i < cutpoint1) || (i > cutpoint2)) {
if (getGeneticAlgorithm().isPreventRepeat()) {
offspring1.setGene(i, getNotTaken(this, taken1));
offspring2.setGene(i, getNotTaken(father, taken2));
} else {
offspring1.setGene(i, getGene(i));
offspring2.setGene(i, father.getGene(i));
}
}
}
if (Math.random() < getGeneticAlgorithm().getMutationPercent()) {
offspring1.mutate();
}
if (Math.random() < getGeneticAlgorithm().getMutationPercent()) {
offspring2.mutate();
}
offspring1.calculateCost();
offspring2.calculateCost();
} |
53f2789c-f370-4553-a332-4cabca51f750 | 0 | public void setPersons(Set<Person> persons) {
this.persons = persons;
} |
d6b72bae-08b0-4062-b199-b7dda4cf3048 | 1 | public List<ArrayOfKeyValueOfstringanyType.KeyValueOfstringanyType> getKeyValueOfstringanyType() {
if (keyValueOfstringanyType == null) {
keyValueOfstringanyType = new ArrayList<ArrayOfKeyValueOfstringanyType.KeyValueOfstringanyType>();
}
return this.keyValueOfstringanyType;
} |
ac32eb40-f10e-4b4d-b0cf-f4e7a3ecd454 | 4 | public void generate(Land[][] world, int heightScale) {
// seed for the world
seed = (float) (System.nanoTime()/10000000);
this.world = world;
// grid of results for the noise algorithm
functionResults = new float[(int) (world.length/xFreq)+4][(int) (world[0].length/zFreq)+4]; // adding 4 to create buffer on edges
int x = 0;
int z = 0;
// populate the results array
for(int i = 0; i<functionResults.length; i++){
for(int j = 0; j<functionResults[0].length; j++){
functionResults[i][j] = function(x-2*xFreq,z-2*zFreq); // making use of buffer
z+=zFreq;
}
x+=xFreq;
}
// interpolate the algorithm results and populate the world
for(int i = 0; i < world.length; i++){
for(int j = 0; j<world[0].length; j++){
world[i][j] = new Land(heightScale*interpolate(i,j),i,j);
}
}
} |
d1de4057-429f-436a-a55b-54b25e57b726 | 9 | public Object[] getEdgesBetween(Object cell1, Object cell2, boolean directed) {
if (graphLayoutCache != null && graphLayoutCache.isPartial()
&& edgePromotion) {
Set cells1 = getHiddenChildren(cell1);
Set cells2 = getHiddenChildren(cell2);
// Optimise for the standard case of no child cells
if (cells1.size() == 1 && cells2.size() == 1) {
return DefaultGraphModel.getEdgesBetween(model, cell1, cell2,
directed);
}
// The object array to be returned
Object[] edgesBetween = null;
Iterator iter1 = cells1.iterator();
while (iter1.hasNext()) {
Object tempCell1 = iter1.next();
Iterator iter2 = cells2.iterator();
while (iter2.hasNext()) {
Object tempCell2 = iter2.next();
Object[] edges = DefaultGraphModel.getEdgesBetween(model,
tempCell1, tempCell2, directed);
if (edges.length > 0) {
if (edgesBetween == null) {
edgesBetween = edges;
} else {
// need to copy everything into a new array
Object[] newArray = new Object[edges.length
+ edgesBetween.length];
System.arraycopy(edgesBetween, 0, newArray, 0,
edgesBetween.length);
System.arraycopy(edges, 0, newArray,
edgesBetween.length, edges.length);
edgesBetween = newArray;
}
}
}
}
return edgesBetween;
} else {
return DefaultGraphModel.getEdgesBetween(model, cell1, cell2,
directed);
}
} |
278fc1f4-bfc7-45f9-850a-2afbcd21a14c | 8 | public Void visitExecutableStatements(ExecutableStatementsContext ctx) {
if (ctx.children == null) return null;
int loc = 1;
for (ParseTree child : ctx.children) {
if (child instanceof ExecutableStatementContext) {
visitExecutableStatement((ExecutableStatementContext) child);
if (ctx.getParent().getRuleIndex() == FortranParser.RULE_procedure &&
loc == ctx.children.size())
appendCode("\n");
} else if (child instanceof CppDirectiveContext) {
if (ctx.getParent().getRuleIndex() == FortranParser.RULE_procedure &&
loc == ctx.children.size())
appendCode("\n");
visitCppDirective((CppDirectiveContext) child);
}
loc++;
}
return null;
} |
419bcade-c8a2-42b6-be10-20757cdc11db | 3 | @Override
public LoggerPanel getLoggerPanel(int defaultID, String supplierName)
{
final Vector<ChoiceItem> data = new Vector<ChoiceItem>(items.size());
for (Entry<Integer, BarItem> item : items.entrySet())
{
ChoiceItem toAdd = new ChoiceItem();
toAdd.id = item.getKey();
toAdd.item = item.getValue();
toAdd.cmpValue = item.getValue().checker.count(supplierName);
data.add(toAdd);
}
Collections.sort(data);
final JLabel infoLabel = new JLabel(data.get(0).item.defaultQtt);
final JComboBox<ChoiceItem> combo = new JComboBox<ChoiceItem>(data);
combo.setSelectedIndex(0);
combo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0)
{
infoLabel.setText(((ChoiceItem) combo.getSelectedItem()).item.defaultQtt);
}
});
@SuppressWarnings("serial")
LoggerPanel loggerPanel = new LoggerPanel() {
@Override
public void setBarID(int id)
{
for (ChoiceItem item : data)
{
if (item.id == id)
{
combo.setSelectedItem(item);
infoLabel.setText(item.item.defaultQtt);
return;
}
}
System.err.println("Corrupt data (Bar2Auto.getLoggerPanel -> setBarID)");
}
@Override
public int getBarID()
{
return ((ChoiceItem) combo.getSelectedItem()).id;
}
};
loggerPanel.setLayout(new BoxLayout(loggerPanel, BoxLayout.Y_AXIS));
JPanel comboPanel = new JPanel(new BorderLayout(5, 0));
comboPanel.add(new JLabel(AutoAppro.messages.getString("bar2auto_type")), BorderLayout.LINE_START);
comboPanel.add(combo, BorderLayout.CENTER);
loggerPanel.add(comboPanel);
JPanel infoPanel = new JPanel(new BorderLayout(5, 0));
infoPanel.add(new JLabel(AutoAppro.messages.getString("bar2auto_info")), BorderLayout.LINE_START);
infoPanel.add(infoLabel, BorderLayout.CENTER);
loggerPanel.add(infoPanel);
return loggerPanel;
} |
537a3917-99c3-476f-9e5e-379f1696cfc3 | 0 | public Teacher(DelayQueue<Student> students,ExecutorService exec) {
super();
this.students = students;
this.exec = exec;
} |
6b94d44a-a695-431f-a52a-bc5fec0f719b | 1 | @Override
public void grabbed(EventMouse eventMouse) {
texPos = sliderTexture.getBobGrabbed();
float posDifference = eventMouse.getPosition().getX() - getPosition().getX() - getScale().getX()/2;
if (posDifference != 0)
setPosition(getPosition().add(new Vector3f(posDifference,0,0)).getXY());
} |
83112210-22b1-48aa-b5de-3a4d61d17fcf | 9 | public static void main(final String[] args) throws Exception {
int i = 0;
int flags = ClassReader.SKIP_DEBUG;
boolean ok = true;
if (args.length < 1 || args.length > 2) {
ok = false;
}
if (ok && "-debug".equals(args[0])) {
i = 1;
flags = 0;
if (args.length != 2) {
ok = false;
}
}
if (!ok) {
System.err.println("Prints the ASM code to generate the given class.");
System.err.println("Usage: ASMifierClassVisitor [-debug] "
+ "<fully qualified class name or class file name>");
return;
}
ClassReader cr;
if (args[i].endsWith(".class") || args[i].indexOf('\\') > -1
|| args[i].indexOf('/') > -1)
{
cr = new ClassReader(new FileInputStream(args[i]));
} else {
cr = new ClassReader(args[i]);
}
cr.accept(new ASMifierClassVisitor(new PrintWriter(System.out)),
getDefaultAttributes(),
flags);
} |
c076c6e4-c7b2-455c-8ab9-c139024aa516 | 0 | public JPanel getjPanelTitre() {
return jPanelTitre;
} |
b4c12325-49af-424a-84a6-66bba1e48aec | 8 | public void setValue(Object value) {
//
// Return an empty string if the value is null
//
if (value == null) {
setText(new String());
return;
}
//
// We must have a Number
//
if (!(value instanceof Number))
throw new IllegalArgumentException("Value is not a Number");
//
// Format the number as a double value
//
String text = formatter.format(((Number)value).doubleValue());
//
// Remove a leading minus sign if the value is zero
//
if (text.charAt(0) == '-') {
int index;
int length = text.length();
for (index=1; index<length; index++) {
char c = text.charAt(index);
if (c != '0' && c != '.')
break;
}
if (index == length)
text = text.substring(1);
}
//
// Set the foreground color to red if the value is negative
//
if (text.charAt(0) == '-')
setForeground(Color.RED);
//
// Set the text value for the number
//
setText(text);
} |
11c5f4d3-4280-4cfb-a0e0-a7a8bbd78c6d | 4 | private int getNum(String text) throws NumberFormatException {
int res = 0;
if(text.startsWith("+="))
res = Integer.parseInt(text.substring(2));
else if(text.startsWith("-="))
res = Integer.parseInt(text.substring(2)) * -1;
else if(text.equals("++"))
res = 1;
else if(text.equals("--"))
res = -1;
else
throw new NumberFormatException();
return res;
} |
c6ad0b5c-e3c4-4478-909d-d45fb144a66e | 2 | private int getTeleporterCoverage() {
int nrSquaresTeleport = 0;
for (Element e : grid.getElementsOnGrid())
if (e instanceof Teleporter) nrSquaresTeleport++;
return (nrSquaresTeleport * 100 / grid.gridSize());
} |
0b35aa03-3d4c-42d5-a048-b07699e98a2c | 3 | public static boolean hasHeadTag(String eadfile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError{
boolean result = false;
FileInputStream fileInputStreamEAD = new FileInputStream(eadfile);
XMLEventReader xmlEventReaderEAD = XMLInputFactory.newInstance()
.createXMLEventReader(fileInputStreamEAD);
while (xmlEventReaderEAD.hasNext()) {
XMLEvent event = xmlEventReaderEAD.nextEvent();
if (event.isStartElement()) {
if (event.asStartElement().getName().getLocalPart()
.equals("head")) {
result = true;
}
}
}
return result;
} |
cf9cd2ab-ddfc-4379-b72a-877f4d46020a | 3 | @Override
public void addProductToCart(UserModel user, int productId, int quantity)
throws WebshopAppException {
if (isValidUser(user, "ADD_PRODUCT_TO_SHOPPING_CART")
&& isPositiveQuantity(quantity, "ADD_PRODUCT_TO_SHOPPING_CART")) {
try (Connection conn = getConnection()) {
int db_quantity = getProductQuantity(conn, user, productId);
deleteProductFromShoppingCart(conn, user, productId);
int newQuantity = db_quantity + quantity;
insertProductQuantity(conn, user, productId, newQuantity);
Log.logOut(LOGGER, this, "ADD_PRODUCT_TO_SHOPPING_CART",
"Added ", String.valueOf(quantity), " product of id: ",
String.valueOf(productId), " to user: ",
user.getEmail());
} catch (SQLException e) {
WebshopAppException excep = new WebshopAppException(e, this
.getClass().getSimpleName(),
"ADD_PRODUCT_TO_SHOPPING_CART");
Log.logOutWAException(LOGGER, excep);
throw excep;
}
}
} |
44613f58-71ce-4811-82f8-1a48585acb68 | 4 | @Override
public void run() {
try {
while (true){
if (!UserList.messages_list.isEmpty()){
System.out.println(UserList.messages_list.size());
String message = UserList.messages_list.get(0).replace("\n", ";;");
GUI.println("Sending message");
for(User value : UserList.user_list.values()){
value.out.println(message);
}
GUI.println(UserList.ready_users.size()+ "" );
GUI.println(message);
UserList.messages_list.remove(0);
}
sleep(100);
}
} catch (Exception e) {
System.out.println("Exception Rised!!!");
}
} |
b30cca28-bbc4-46d6-a5af-1aa840778713 | 2 | public static FloatBuffer createFilppedBuffer(Matrix4f value)
{
FloatBuffer buffer = createFloatBuffer(4 * 4);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j ++)
{
buffer.put(value.get(i, j));
}
}
buffer.flip();
return buffer;
} |
49dcfbe9-28f5-4c47-a2ad-aaa9bc0c5fea | 1 | public void add( V val,K key, W address){
if (root == null) {
root = new BinaryNode<K,V,W>(val,key,address,null,null);
}
else{
root.insert(val,key,address);
}
} |
cd475117-265b-4016-8e4f-eb495fe0d1c7 | 2 | public void setHover (boolean visible) {
if (champion != null) {
if (visible)
championIcon.setIcon (HOVER);
else championIcon.setIcon (null);
}
} |
4c7a395d-de6f-4497-83c6-f0db8b3f1c2b | 5 | public void setEndTime(int hr, int min) {
if (hr < 24 && hr >= 0) {
if (hr > this.tStart[0]) {
this.tEnd[0] = hr;
} else {
this.tEnd[0] = tStart[0] + 1;
}
}
if (min < 60 && min >= 0) {
this.tEnd[1] = min;
}
super.updateDate = new Date();
} |
8bb1ab86-a464-48c3-86e1-826e4b622c8c | 3 | @Override
public void caseASeExplogSenaoComando(ASeExplogSenaoComando node)
{
inASeExplogSenaoComando(node);
{
List<PComando> copy = new ArrayList<PComando>(node.getSenaoF());
Collections.reverse(copy);
for(PComando e : copy)
{
e.apply(this);
}
}
{
List<PComando> copy = new ArrayList<PComando>(node.getSeV());
Collections.reverse(copy);
for(PComando e : copy)
{
e.apply(this);
}
}
if(node.getExpLogica() != null)
{
node.getExpLogica().apply(this);
}
outASeExplogSenaoComando(node);
} |
23f53509-91f9-4606-bf70-711936306a3e | 4 | public Object getValueAt(int row, int col) {
if(null == data)
return null;
if(col>=columnNames.length || col<0 || row<0)
return null;
return data[row][col];
} |
e376d2b8-0a52-485f-9d20-3de8ed87b1f6 | 2 | public boolean isValidType() {
return ifaces.length == 0 || (clazz == null && ifaces.length == 1);
} |
380f24c9-1b0f-482c-ae71-8a590566425d | 8 | @Override
public void init() {
/* 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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Aulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Aulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Aulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Aulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the applet */
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
addItemsComobox();
try {
loadDataToTable();
} catch (SQLException ex) {
Logger.getLogger(Usuarios.class.getName()).log(Level.SEVERE, null, ex);
}
} |
722305c9-07de-4b6f-b2cf-59b7cc49af60 | 2 | @RequestMapping(value = "/saveEmployee", method = RequestMethod.POST)
public String saveCustomer(@ModelAttribute("employee") Employee employee, BindingResult result) {
if (employee.getEmployeeId() == null)
{
GenericDAO<Worktype> worktypesDAO = getWorktypesDAO();
Set<Worktype> worktypes = new HashSet<Worktype>();
for (Worktype type : employee.getWorktypes())
{
Worktype typeObject = worktypesDAO.getWithCriterion(Expression.eq("name", type.getName())).get(0);
typeObject.getEmployees().add(employee);
}
getEmployeesDAO().create(employee);
}
else
{
Employee employeeObject = getEmployeesDAO().getById(employee.getEmployeeId());
employeeObject.setDataWithObject(employee);
getEmployeesDAO().update(employeeObject);
}
return "redirect:employees.htm";
} |
0b6d1bed-2e98-46c6-bc7c-35bd604dfd50 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_ANY);
if((target==null)||(target.fetchEffect(ID())!=null))
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
Ability A=(Ability)copyOf();
A.startTickDown(mob,target,Ability.TICKS_ALMOST_FOREVER);
Environmental msgTarget=target;
if(target instanceof CagedAnimal)
msgTarget=((CagedAnimal)target).unCageMe();
mob.location().show(mob,msgTarget,CMMsg.MSG_OK_VISUAL,L("<T-NAME> has soiled <T-HIM-HERSELF>!"));
if(target instanceof MOB)
{
final Item pants=((MOB)target).fetchFirstWornItem(Wearable.WORN_WAIST);
if((pants!=null)&&(pants.fetchEffect(ID())==null))
{
A=(Ability)copyOf();
A.startTickDown((MOB)target,pants,Ability.TICKS_ALMOST_FOREVER);
}
}
return true;
} |
a37eb364-9532-4328-9549-055027d9eb9a | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
Outliner.menuBar.helpMenu = this;
} |
06c5a841-ea51-40a5-bb9e-73663b8d5e13 | 8 | protected String parseHeader(String input) {
String[] lines = input.split("\r?\n", -1);
StringBuilder result = new StringBuilder();
boolean readingHeader = true;
boolean foundHeader = false;
for (int i = 0; (i < lines.length) && (readingHeader); i++) {
String line = lines[i];
if (line.startsWith(COMMENT_PREFIX)) {
if (i > 0) {
result.append("\n");
}
if (line.length() > COMMENT_PREFIX.length()) {
result.append(line.substring(COMMENT_PREFIX.length()));
}
foundHeader = true;
} else if ((foundHeader) && (line.length() == 0)) {
result.append("\n");
} else if (foundHeader) {
readingHeader = false;
}
}
return result.toString();
} |
b4b5cbdf-dadf-4884-9acf-24d93153eb24 | 1 | private void sendMessage(JButton confirmButton) {
if (status.equals(GameStatus.NIGHT)) controller.sendMessage(new MafiaVotedOutVillagerMessage(votedOutPlayer));
else controller.sendMessage(new VillagerVotedOutMafiaMessage(votedOutPlayer));
disableVoteButtons(confirmButton);
} |
707235fe-20e6-4d94-bac4-b4c882e36038 | 5 | @Override
public void update(PositionChangedObservable observable) {
if(observable != this) {
if(observable.getPositions().contains(position)) {
addHoveringElement(observable);
if(getLifetime() > 0)
observable.accept(new CollideWithPowerFailureVisitor());
} else if(hoveringElements.remove(observable) && shouldCollide(observable))
observable.accept(new DeactivatePowerFailureVisitor());
}
} |
d9af10a2-5a02-4d76-9f91-9584b6e6ee72 | 4 | public void init(int mode, byte[] key, byte[] iv) throws Exception{
String pad="NoPadding";
// if(padding) pad="PKCS5Padding";
byte[] tmp;
if(iv.length>ivsize){
tmp=new byte[ivsize];
System.arraycopy(iv, 0, tmp, 0, tmp.length);
iv=tmp;
}
if(key.length>bsize){
tmp=new byte[bsize];
System.arraycopy(key, 0, tmp, 0, tmp.length);
key=tmp;
}
try{
SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
cipher.init((mode==ENCRYPT_MODE?
javax.crypto.Cipher.ENCRYPT_MODE:
javax.crypto.Cipher.DECRYPT_MODE),
skeySpec, new IvParameterSpec(iv));
}
catch(Exception e){
throw e;
}
} |
5bc8d691-db34-4983-b8e3-4f70c8047704 | 1 | public QueryUserByIdentityNumberResponse queryUserByIdentityNumber(QueryUserByIdentityNumberRequest request)
throws GongmingConnectionException, GongmingApplicationException {
URL path = _getPath(QUERY_USER_BY_IDENTITY_NUMBER);
QueryUserByIdentityNumberResponse response = _GET(path, request, QueryUserByIdentityNumberResponse.class);
if (response.code != GMResponseCode.COMMON_SUCCESS) {
throw new GongmingApplicationException(response.code.toString(), response.errorMessage);
}
return response;
} |
9bbe469c-4d6c-4ddf-a31f-cbf475b39d94 | 1 | public Class[] getParameterClasses() throws ClassNotFoundException {
Class[] paramClasses = new Class[parameterTypes.length];
for (int i = paramClasses.length; --i >= 0;)
paramClasses[i] = parameterTypes[i].getTypeClass();
return paramClasses;
} |
d49f4343-96ee-4cff-aced-5b659aa96cf1 | 2 | public void mergeGenKill(Collection gen, SlotSet kill) {
grow(gen.size());
big_loop: for (Iterator i = gen.iterator(); i.hasNext();) {
LocalInfo li2 = (LocalInfo) i.next();
if (!kill.containsSlot(li2.getSlot()))
add(li2.getLocalInfo());
}
} |
5699dc6c-5458-400c-b451-cc9538851242 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
788a67b6-591a-42e2-acdd-a4f6790bc482 | 2 | public Map<Integer, CatalogItem> GrabItemsByPage(int ID)
{
Map<Integer, CatalogItem> Itemz = new HashMap<Integer, CatalogItem>();
for(CatalogItem Item : Items.values())
{
if (Item.Page == ID)
{
Itemz.put(new Integer(Item.ID), Item);
}
}
return Itemz;
} |
a92eb488-a57f-44fd-815b-fa21502fff4e | 1 | public PokeFont() {
super(font);
File f = new File("res/Font/PokemonFont.ttf");
FileInputStream in;
try {
in = new FileInputStream(f);
dFont = Font.createFont(Font.TRUETYPE_FONT, in);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
font = setSize(20);
} |
10d0d7de-013e-4ff0-a5e8-b134b7f8ce17 | 3 | public static void saveAllPlayers(boolean clearOfflinePlayers){
Iterator<Entry<String, PlayerData>> i = data.entrySet().iterator();
while(i.hasNext()){
Entry<String, PlayerData> e = i.next();
e.getValue().saveData();
if(clearOfflinePlayers){
Player p = Bukkit.getPlayerExact(e.getKey());
if(!p.isOnline()) data.remove(e.getKey());
}
}
} |
eb2360c7-8e42-47fd-97f9-7ca52c3bd31b | 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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Listar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Listar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Listar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Listar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Listar().setVisible(true);
}
});
} |
a9d3f6fe-8efd-4a14-a2c9-ef42d251ae24 | 4 | public void addToPosition(int place, int value) {
ListElement current = new ListElement(value);
int nextCount = count + 1;
if (place == first) {
addToStart(value);
} else if (place == nextCount) {
addToEnd(value);
} else if (place < nextCount) {
ListElement help = head;
ListElement previous = head;
for (int i = 1; i < place; i++) {
previous = help;
help = help.next;
}
previous.next = current;
current.next = help;
count++;
} else {
System.out.println("Wrong place!");
}
} |
2936a21c-894d-4e53-8025-4ff73e57cfda | 6 | public static boolean isGreaterThan(Date inDate, Date dateToCompare){
if(inDate.getYear() > dateToCompare.getYear()){
return true;
}else if(inDate.getYear() < dateToCompare.getYear()){
return false;
}else{
if(inDate.getMonth() > dateToCompare.getMonth()){
return true;
}else if(inDate.getMonth() < dateToCompare.getMonth()) {
return false;
}else{
if(inDate.getDate() > dateToCompare.getDate()){
return true;
}else if (inDate.getDate() < dateToCompare.getDate()){
return false;
}else{
return false;
}
}
}
} |
040fe654-0e31-4f6f-aa0e-0d543f2f57e1 | 6 | public String toBizHawkString() {
StringBuilder str = new StringBuilder();
// UDLRBAZSLRudlr xxx, yyy
str.append("|.|...."); // UDRL
str.append(b ? "B" : "."); // B
str.append(a ? "A" : "."); // A
str.append(z ? "Z" : "."); // Z
str.append(".."); // Start , L
str.append(r ? "R" : "."); // R
str.append("...."); // c buttons;
str.append( x<0 ? "-" : " ");
str.append(String.format("%03d", Math.abs(x)));
str.append(",");
str.append( y<0 ? "-" : " ");
str.append(String.format("%03d", Math.abs(y)));
str.append( "|.............. 000, 000|.............. 000, 000|.............. 000, 000|"); // other players
return str.toString();
} |
fa6ea2e9-d785-4a24-98fd-4c80bd6abf5f | 7 | @Override
public List<Point> findWay(Node<Point> start, Node<Point> goal, ListGraph<Point> graph) {
this.closedList = new LinkedList<Node<Point>>();
this.openList = new LinkedList<Node<Point>>();
Node<Point> current = start;
// ADD IT TO OPEN LIST
openList.add(current);
while (!openList.isEmpty()) {
openList.sort((n1, n2) -> {
return (int) (n1.getF() - n2.getF());
});
// REMOVE FIRST NODE
// O(1)
current = openList.remove(0);
// ADD TO CLOSED LIST
// O(1)
closedList.add(current);
// TEMP SAVE THE LAST ADDED NODE
lastNode = current;
// GOAL FOUND - STOP ASTAR
if (current.equals(goal))
return getPath();
// GET POSSIBLE NEXT NODES
List<Node<Point>> neighbors = graph.getNeighbors(current);
// Node[] neighbors = level.getNeighbors(current, onlyFree);
// CHECK POSSIBILITIES
for (Node<Point> neighbor : neighbors) {
// NODE IS OUTSIDE THE FIELD
if (neighbor == null)
continue;
// IGNORE NODES WHICH ARE IN CLOSED LIST
if (closedList.contains(neighbor))
continue;
// O(N)
if (openList.contains(neighbor)) {
// NEW PATH IS BETTER
if (neighbor.getG() < current.getG()) {
// REMOVE AND ADD TO OPENLIST TO RESTORE SORT
// O(N)
openList.remove(neighbor);
// UPDATE PREV AND G
neighbor.setPreviosNode(current);
neighbor.setG(current.getG() + 1);
// LOG(N)
openList.add(neighbor);
}
} else {
// NODE IS NOT IN OPEN NOR CLOSED LIST - ADD IT
neighbor.setPreviosNode(current);
// LOG(N)
openList.add(neighbor);
}
}
}
return null;
} |
cd471594-cc08-409a-b50f-27d1abddc416 | 1 | static void test(Fraction f1, Fraction f2, String msg){
if (! f1.equals(f2))
System.out.println(msg);
} |
90d0a578-a53e-4ce1-9ed2-709ae83398d0 | 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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MAdministrador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MAdministrador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MAdministrador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MAdministrador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MAdministrador(null).setVisible(true);
}
});
} |
de138b45-cfdf-49c4-8200-88b07f564974 | 6 | public static Properties load(String [] paths, String fileName) {
Properties properties = null;
File propertiesFile = null;
try {
String path = null;
for(int i=0; i<paths.length; i++) {
path = paths[i] + File.separator + fileName;
propertiesFile = new File(path);
if(propertiesFile.exists()) break;
}
if(!propertiesFile.exists()) {
System.err.println("FATAL: could not find file '" + fileName +
"' in default search paths: ");
for(int i=0; i<paths.length; i++) {
System.err.print("'" + paths[i] + "'");
if(i < paths.length - 1)
System.err.print(", ");
}
System.err.println();
System.exit(1);
}
properties = refresh(propertiesFile.getAbsolutePath(),
new FileInputStream(propertiesFile));
}
catch(Exception e) {
System.err.println("ERROR: couldn't load properties from '" +
propertiesFile + "'");
}
return properties;
} |
6b93d070-3e39-4f0d-ba15-d1cc209c9bba | 6 | private static void browse(String url) throws ClassNotFoundException, IllegalAccessException,
IllegalArgumentException, InterruptedException, InvocationTargetException, IOException,
NoSuchMethodException {
String osName = System.getProperty("os.name", "");
if (osName.startsWith("Mac OS")) {
Class fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
openURL.invoke(null, new Object[] { url });
} else if (osName.startsWith("Windows")) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
} else { // assume Unix or Linux
String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0)
browser = browsers[count];
if (browser == null)
throw new NoSuchMethodException("Could not find web browser");
else
Runtime.getRuntime().exec(new String[] { browser, url });
}
} |
71b2f398-0395-4e15-8cd7-5be8cea1899f | 4 | public boolean addNoClaimChunk(String chunk)
{
if(this.noclaim.contains(chunk)) return false;
if(this.chunkIsOwned(chunk))
{
if(this.owners.containsKey(chunk))
{
String owner = this.owners.remove(chunk);
Player p = Bukkit.getPlayer(owner);
if(p != null)
{
p.sendMessage(GOLD+"Your chunk was claimed as a noclaim chunk");
}
}
this.owners.remove(chunk);
this.chunkSet.remove(chunk);
}
List<String> noclaims = p.getConfig().getStringList("noclaim-chunks");
noclaims.add(chunk);
p.getConfig().set("noclaim-chunks", noclaims);
p.saveConfig();
return this.noclaim.add(chunk);
} |
53e234f6-632f-41b3-b4fa-dc009b39a8b7 | 3 | @Override
public int compareTo( VoteItem o ) {
if ( o instanceof VoteItem ) {
VoteItem otherVoteItem = (VoteItem) o;
if ( this.getScore() < otherVoteItem.getScore() ) {
return 1;
} else if ( this.getScore() > otherVoteItem.getScore() ) {
return -1;
} else {
return 0;
}
} else {
return 0;
}
} |
a059d43a-2d50-4559-a3dc-e5cc3b04d61e | 8 | public static void finalizeObjectAxioms(Stella_Object self) {
{ Object old$Termsourcebeingparsed$000 = Logic.$TERMSOURCEBEINGPARSED$.get();
Object old$LogicDialect$000 = Logic.$LOGIC_DIALECT$.get();
try {
Native.setSpecial(Logic.$TERMSOURCEBEINGPARSED$, null);
Native.setSpecial(Logic.$LOGIC_DIALECT$, Logic.KWD_KIF);
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, self.homeModule());
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
{ LogicObject self000 = ((LogicObject)(self));
Native.setSpecial(Logic.$TERMSOURCEBEINGPARSED$, Logic.stringifiedSource(self000));
if (Logic.axioms(self000) == null) {
return;
}
KeyValueList.setDynamicSlotValue(self000.dynamicSlots, Logic.SYM_STELLA_BADp, Stella.TRUE_WRAPPER, null);
{ Cons theaxioms = Logic.helpFinalizeObjectAxioms(Logic.axioms(self000));
if (theaxioms == Stella.NIL) {
return;
}
else {
{ Proposition p = null;
Cons iter000 = theaxioms;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
p = ((Proposition)(iter000.value));
Logic.linkOriginatedProposition(self000, p);
}
}
}
}
Logic.axiomsSetter(self000, null);
KeyValueList.setDynamicSlotValue(self000.dynamicSlots, Logic.SYM_STELLA_BADp, null, null);
}
}
else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
{ Proposition self000 = ((Proposition)(self));
Native.setSpecial(Logic.$TERMSOURCEBEINGPARSED$, Logic.stringifiedSource(self000));
if (Logic.axioms(self000) == null) {
return;
}
KeyValueList.setDynamicSlotValue(self000.dynamicSlots, Logic.SYM_STELLA_BADp, Stella.TRUE_WRAPPER, null);
{ Cons theaxioms = Logic.helpFinalizeObjectAxioms(Logic.axioms(self000));
if (theaxioms == Stella.NIL) {
return;
}
else {
{ Proposition p = null;
Cons iter001 = theaxioms;
for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
p = ((Proposition)(iter001.value));
Logic.linkOriginatedProposition(self000, p);
}
}
}
}
Logic.axiomsSetter(self000, null);
KeyValueList.setDynamicSlotValue(self000.dynamicSlots, Logic.SYM_STELLA_BADp, null, null);
}
}
else {
{ OutputStringStream stream000 = OutputStringStream.newOutputStringStream();
stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
}
}
}
} finally {
Stella.$CONTEXT$.set(old$Context$000);
Stella.$MODULE$.set(old$Module$000);
}
}
} finally {
Logic.$LOGIC_DIALECT$.set(old$LogicDialect$000);
Logic.$TERMSOURCEBEINGPARSED$.set(old$Termsourcebeingparsed$000);
}
}
} |
2dfb5210-7f9f-4512-8d72-373da4d2861c | 7 | public static void main(String[] args){
// abstractPathname = "MyTextFile.txt";
abstractPathname = "C:";
file = new File(abstractPathname);
// file.createNewFile();
if(file.exists()){
System.out.println("File or Directory exists.");
if(file.isFile()){
System.out.println("This is file.");
if(file.canRead()){
System.out.println("File is readable.");
}
if(file.canWrite()){
System.out.println("File is writable.");
}
}
else if(file.isDirectory()){
System.out.println("This is directory.");
if(file.canRead()){
System.out.println("Directory is readable.");
}
if(file.canWrite()){
System.out.println("Directory is writable.");
}
}
}
else{
System.out.println("No such File or Directory exists.");
}
} |
2d82d8e4-f227-424f-8753-c3ba78091a45 | 2 | public static long toLong(byte ... b) {
int mask = 0xff;
int temp = 0;
long res = 0;
int byteslen = b.length;
if (byteslen > 8) {
return Long.valueOf(0L);
}
for (int i = 0; i < byteslen; i++) {
res <<= 8;
temp = b[i] & mask;
res |= temp;
}
return res;
} |
fdbc7d0e-cdcc-410c-a6e6-780403fcdabe | 4 | public static void main (String[] args) throws IOException, ClassNotFoundException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException {
String jarFilePath = "WordCount.jar";
JarFile jarFile = new JarFile(jarFilePath);
Enumeration<JarEntry> e = jarFile.entries();
URL[] urls = { new URL("jar:file:" + jarFilePath +"!/") };
ClassLoader cl = URLClassLoader.newInstance(urls);
Class executeClass = null;
while (e.hasMoreElements()) {
JarEntry je = e.nextElement();
if(je.isDirectory() || !je.getName().endsWith(".class")){
continue;
}
String className = je.getName().substring(0,je.getName().length()-6);
className = className.replace('/', '.');
if (className.equals("Execute")) {
executeClass = cl.loadClass(className);
}
}
TempRunner runner = (TempRunner) executeClass.getConstructors()[0].newInstance();
runner.run();
} |
857e0c57-a3aa-49ec-a622-b696485f9f1d | 7 | public void compute3KindCategoryPoints(Dice[] roll)
{
if(this.ones >= 3 || this.twos >= 3 || this.threes >= 3 || this.fours >= 3 || this.fives >= 3 || this.sixes >= 3)
{
for(int i=0; i<5; i++)
{
scoreArray[THREEKIND_INDEX] += roll[i].face;
}
}
else
{
scoreArray[THREEKIND_INDEX] = 0;
}
} |
058c6d1d-822f-401b-9966-b79c690d02cb | 3 | public boolean isPoweredOn(String vmName) throws Exception {
String vmSearch = doGet(apiLink + Utils.VMS_QUERY_SUFFIX);
Document doc = RestClient.stringToXmlDocument(vmSearch);
NodeList list = doc.getElementsByTagName(Constants.VM_RECORD);
String vmRef = new String();
for(int i=0; i < list.getLength(); i++){
if(list.item(i).getAttributes().getNamedItem(Constants.NAME).getTextContent().trim().equalsIgnoreCase(vmName))
{
if(list.item(i).getAttributes().getNamedItem(Constants.STATUS).getTextContent().trim().equalsIgnoreCase("POWERED_ON"))
{
return true;
}
}
}
return false;
} |
d2f1280d-f6af-4154-9f44-aed3ecdd35bb | 9 | public boolean step() {
// get relevant rule
int c = grid[pos_x][pos_y];
Rule r = rules.getRule(state, c);
if (r == null) {
System.out.println("No rule for state " + state + ", colour " + c + "!");
System.exit(-1);
}
//Change the colour and state, work out new direction, and move.
grid[pos_x][pos_y] = r.getColour();
state = r.getState();
switch (r.getDirection()) {
case 8:
direction += 1;
break;
case 4:
direction += 2;
break;
case 2:
direction += 3;
break;
case 0:
return false; //Halting state
}//If it's 1, don't need to do anything. Can ignore other numbers.
direction %= 4; //Make sure it's still in range
switch (direction) {
case 0:
pos_y--;
break;
case 1:
pos_x--;
break;
case 2:
pos_y++;
break;
case 3:
pos_x++;
break;
}
pos_x = (pos_x + width) % width; //Wraps position around
pos_y = (pos_y + height) % height;
return true;
} |
6c30811f-753b-4654-b416-6ccac057367b | 3 | private static int getRepresentation(final String s) {
if ("code".equals(s)) {
return BYTECODE;
} else if ("xml".equals(s)) {
return MULTI_XML;
} else if ("singlexml".equals(s)) {
return SINGLE_XML;
}
return 0;
} |
2229feab-db37-4a32-9678-94ffc4f0882b | 3 | public void collideWithPlayer(final PlayerEntity player, final int delta) {
boolean playerToLeft = player.pos.x - pos.x - SIZE / 2 < 0;
Vector2d target = pos.copy();
if (playerToLeft)
target.add(0.03 * delta, 0);
else
target.add(-0.03 * delta, 0);
boolean isValide = World.getInstance().isValidPos(target, this)
&& World.getInstance().isValidPos(target.copy().add(SIZE - 1, 0), this);
if (isValide) {
pos.set(target);
collisionBox.x = pos.x();
}
// System.out.println("Valid move: " + isValide);
} |
1a446b1e-5b93-4ee6-90e7-5eace7cc0265 | 7 | public Strike(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "class":
clazz = Class.parse(this, v);
break;
case "dir":
dir = Dir.parse(this, v);
break;
case "id":
id = Id.parse(this, v);
break;
case "lang":
lang = Lang.parse(this, v);
break;
case "style":
style = Style.parse(this, v);
break;
case "title":
title = Title.parse(this, v);
break;
}
}
} |
14194efa-e6f3-49bb-af84-bf4f0c8e36bd | 4 | public boolean verifyConnection(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
this.connect=DriverManager.getConnection("jdbc:mysql:"+this.link,this.username, this.passwd);
this.statement=this.connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
return true;
}catch(SQLException ex){
Logger.getLogger(ImportDriver.class.getName()).log(Level.SEVERE, null, ex);
}
catch(ClassNotFoundException ex){
Logger.getLogger(ImportDriver.class.getName()).log(Level.SEVERE, null, ex);
}
catch(InstantiationException ex){
Logger.getLogger(ImportDriver.class.getName()).log(Level.SEVERE, null, ex);
}
catch(IllegalAccessException ex){
Logger.getLogger(ImportDriver.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
} |
7dbb3bd6-c45b-4b4b-879b-9aace93aeb0f | 9 | @Override
public final int index() {
final int key = this._key_;
final BEXFileLoader owner = this._owner_;
switch (BEXLoader._typeOf_(key)) {
case BEX_VOID_TYPE:
return -1;
case BEX_ATTR_NODE: {
final IAMArray array = owner._attrParentRef_;
if (array.length() == 0) return -1;
final int ref = BEXLoader._refOf_(key);
return ref - owner._attrListRange_.get(owner._chldAttributesRef_.get(array.get(ref)));
}
case BEX_ELEM_NODE: {
final IAMArray array = owner._chldParentRef_;
if (array.length() == 0) return -1;
final int ref = BEXLoader._refOf_(key);
final int parentRef = array.get(ref);
if (ref == parentRef) return -1;
return ref - owner._chldListRange_.get(-owner._chldContentRef_.get(parentRef));
}
case BEX_TEXT_NODE: {
final IAMArray array = owner._chldParentRef_;
if (array.length() == 0) return -1;
final int ref = BEXLoader._refOf_(key);
return ref - owner._chldListRange_.get(-owner._chldContentRef_.get(array.get(ref)));
}
case BEX_ELTX_NODE:
return 0;
}
throw new IAMException(IAMException.INVALID_HEADER);
} |
3601d4b2-8a46-4e84-a52c-ca819110bcab | 2 | private TowerView getTowerView(Tower t) {
for (TowerView tv : towers) {
if (tv.getTower().equals(t)) {
return tv;
}
}
//if it's not already in the list create a new and add it
TowerView tv = new TowerView(t);
towers.add(tv);
return tv;
} |
982097bb-f41e-4f5b-b3e7-85ebf22cedf2 | 3 | public void open() {
if (this.state != CellState.CLOSED) return;
if (hasMine()) {
explodeMine();
} else {
this.state = CellState.OPENED;
notifyObservers("Opened");
if (countNeighborsWithMines() == 0) openNeighbors();
}
} |
403128d0-92dd-4850-a9e9-416c821ce2da | 0 | public int Decksize(){
return size;
} |
9b0fed89-302a-47eb-b4d5-727ad84138cb | 0 | public void setZipCode(String zipCode) {
this.zipCode.set(zipCode);
} |
37ee726a-d261-467e-a637-0b30408178dc | 9 | private void handleMenuInput() {
if (this.upHelper.state()) {
this.activeMenu.up();
} else if (this.downHelper.state()) {
this.activeMenu.down();
} else if (this.enterHelper.state()) {
if (this.activeMenu instanceof BattleActionMenu) {
BattleActionMenu.Action action = (BattleActionMenu.Action) this.activeMenu.choose();
switch (action) {
case MOVE:
this.currentActor = this.grid.getSelectedTile().getOccupant();
this.state = GameState.MOVING;
this.grid.setMoveRadius(this.grid.getSelectedLocation(), this.currentActor.getMoveSpeed());
this.message = "Moving. Press ENTER to place or ESC to cancel.";
this.showMessage = true;
break;
case ATTACK:
this.currentActor = this.grid.getSelectedTile().getOccupant();
this.currentEffect = new BasicAttack(this.currentActor, this.grid);
this.state = GameState.ATTACKING;
this.message = "Attacking. Press ENTER to choose your target or ESC to cancel.";
this.showMessage = true;
break;
case CAST:
this.currentActor = this.grid.getSelectedTile().getOccupant();
this.currentEffect = new Cure(this.currentActor, this.grid);
this.state = GameState.ATTACKING;
this.message = "Casting Cure!";
this.showMessage = true;
break;
case CANCEL:
default:
break;
}
}
this.activeMenu = null;
}
if (this.activeMenu != null) {
this.message = this.activeMenu.getDescription();
}
} |
d1a9fe9c-8852-4552-83cd-fe2cc6a6963c | 0 | @Override
public boolean pollControls() {
Main.KEYBOARD_LISTENER.recordPollСontrols(KEYS, keyStates);
return !Display.isCloseRequested();
} |
228f9139-ceb8-46aa-92bc-0d35cf9b6a11 | 7 | public int getMedianOfTwoArrays(int[] a1, int[] a2, int start1, int end1, int start2, int end2) {
int length = end1 - start1 + 1;
if (length == 0)
return -1;
if (length == 1)
return (a1[0] + a2[0]) / 2;
if (length == 2)
return (Math.max(a1[start1 + 0], a2[start2 + 0]) + Math.min(a1[start1 + 1], a2[start2 + 1])) / 2;
int m1 = getMedian(a1, start1, end1);
int m2 = getMedian(a2, start2, end2);
if (m1 == m2)
return m1;
else if (m1 > m2) {
if (length % 2 == 0) {
return getMedianOfTwoArrays(a1, a2, start1 + 0, start1 + (length / 2), start2 + (length / 2) - 1, start2 + length - 1);
} else {
return getMedianOfTwoArrays(a1, a2, start1 + 0, start1 + ((length - 1) / 2), start2 + ((length - 1) / 2), start2 + length - 1);
}
} else {
if (length % 2 == 0) {
return getMedianOfTwoArrays(a1, a2, start1 + (length / 2) - 1, start1 + length - 1, start2 + 0, start2 + (length / 2));
} else {
return getMedianOfTwoArrays(a1, a2, start1 + ((length - 1) / 2), start1 + length - 1, start2 + 0, start2 + ((length - 1) / 2));
}
}
} |
395b057f-0a13-4255-a13f-f60d4011f2f9 | 9 | private Method findStaticGetter(Class<?> theClass, String propertyName) {
Method[] methods = theClass.getMethods();
for (Method method : methods) {
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
String methodName = method.getName();
String postfix = null;
if (methodName.startsWith("get")) { //$NON-NLS-1$
postfix = methodName.substring(3);
} else if (methodName.startsWith("is")) { //$NON-NLS-1$
postfix = methodName.substring(2);
} else {
continue;
}
if ((method.getParameterTypes().length != 0)
|| (method.getReturnType() == void.class)) {
continue;
}
postfix = Introspector.decapitalize(postfix);
if (postfix.equals(propertyName)) {
return method;
}
}
}
return null;
} |
4259b8a4-abe1-4ba7-b97f-dff7ab0ffd7b | 6 | public boolean mousedown(Coord c, int button) {
if (folded) {
//recalcSize(this.sz);
return super.mousedown(c, button);
}
parent.setfocus(this);
raise();
Resource h = bhit(c);
if (button == 1) {
if (h != null) {
pressed = h;
ui.grabmouse(this);
return true;
} else {
ui.grabmouse(this);
doff = c;
if (c.isect(sz.sub(gzsz), gzsz)) {
rsm = true;
return true;
}
}
} else if ((button == 3) && (h != null)) {
right_click_pressed = h;
return true;
}
return super.mousedown(c, button);
} |
ccf2ebc3-0856-40e6-a294-e7630b69f721 | 4 | private void setUpWeapons() {
for (int i = 0; i < 25; i++) {
weapons.add("Weapons" + File.separator + "dagger.properties");
}
for (int i = 0; i < 15; i++) {
weapons.add("Weapons" + File.separator + "shortsword.properties");
}
for (int i = 0; i < 10; i++) {
weapons.add("Weapons" + File.separator + "longsword.properties");
}
for (int i = 0; i < 5; i++) {
weapons.add("Weapons" + File.separator + "scimitar.properties");
}
weapons.add("Weapons" + File.separator + "diamondsword.properties");
// add others
} |
07911d57-f405-40b2-a9ee-68ef433c2dd4 | 6 | public synchronized void jvnUnLock() throws JvnException {
System.out.println("unlock STATE : "+STATE+" waitforread : "+wait_for_read+" waitforwrite : "+wait_for_write+" "+System.currentTimeMillis());
if(STATE == STATE_ENUM.R){
if(wait_for_write){
wait_for_write = false;
STATE = STATE_ENUM.NL;
this.notify();
}
else{
STATE = STATE_ENUM.RC;
}
}
else if(STATE == STATE_ENUM.W || STATE == STATE_ENUM.RWC){
if(wait_for_write || wait_for_read){
wait_for_write = false;
wait_for_read = false;
STATE = STATE_ENUM.NL;
this.notify();
}
else{
STATE = STATE_ENUM.WC;
}
}
else{
throw new JvnException("Execution de jvnUnLock() sur un jnvObject id ="+joi+" avec l'état "+STATE);
}
System.out.println("unlock STATE : "+STATE+" waitforread : "+wait_for_read+" waitforwrite : "+wait_for_write+" finishhhhhhhh"+" "+System.currentTimeMillis());
} |
4c37cc88-bbf4-4115-9bc8-606523bd6070 | 4 | private static void initKeywordMergeMap()
{
Iterator p = map.keySet().iterator();
while( p.hasNext() )
{
final String key = ( String )p.next();
if( key.indexOf( ' ' ) > -1 )
{
final String[] array = key.split( "\\s+" );
final String firstKeyword = array[ 0 ];
if( firstKeyword.length() > maxMergedKeywordLength )
{
maxMergedKeywordLength = firstKeyword.length();
}
List list = ( List )keywordMergeMap.get( firstKeyword );
if( list == null )
{
list = new ArrayList();
}
list.add( new ArrayList( Arrays.asList( array ) ) );
Collections.sort( list, new MListSizeComparator() );
keywordMergeMap.put( firstKeyword, list );
}
}
} |
fa3d9d8d-8886-4a21-938c-f589848f3883 | 5 | public void busquedaOrdenada(T dato){
if(dato instanceof Integer ){
Nodo<T> nodoQ = this.inicio;
while(nodoQ != null && (Integer)nodoQ.getInfo() < (Integer) dato){
nodoQ = nodoQ.getLiga();
}
if(nodoQ == null ||(Integer) nodoQ.getInfo() > (Integer)dato){
System.out.println("El elemento no se encontro en la lista");
}else{
System.out.println("El elemento se encontro en la lista");
}
}else{
System.out.println("No es entero");
}
} |
8f57b9b6-1f29-4adb-b298-2e6d93f71bc5 | 0 | @Override
public void init(List<String> argumentList) {
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.