method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9dc0aa66-63c0-4250-ac3e-75d2a8e2abe1 | 6 | public static int RoomService(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = false;
System.out.println("Que voulez vous prendre?"
+ "\n pour de la nourriture tapez 1 (50€)"
+ "\n pour de la boisson tapez 2");
do {
... |
b278be14-78d5-4829-8907-95c5e865cda8 | 7 | public static void refreshCalendar(int month, int year){
String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int nod, som; //Number Of Days, Start Of Month
//Allow/disallow buttons
btnPrev.setEnabled(true);
btnNext.set... |
e827c1f4-6246-4893-8817-e0989c381784 | 3 | public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("nome");
Object linhas[][] = new Object[list.size()][];
int i = 0;
for (Curso curso : list)
{
linhas[i] = formatoTabela(curso);
i++;
}
view.getTabela().setModel(
... |
19d7296f-fea3-459f-b2b7-2a64a3ee5d5f | 3 | private static void doMarketSum() {
ArrayList<String> validDataTickers = new ArrayList<String>();
for (Entry<String, TreeMap<Float, float[]>> individual : Database.TECHNICAL_PRICE_DATA
.entrySet()) {
if (isAllDataValid(individual.getValue())) {
validDataTickers.add(individual.getKey());
}
}
System... |
c9b10869-3590-4d93-8541-9a4276c318b8 | 7 | public Response addChar(byte c)
{
//Le caractère de début est reçu
if ( c == (byte)0xc2 )
{
// S'il y avait déjà une réponse dans le buffer, on l'ignore
if ( sb.length() != 0 )
reset();
}
// On continue la réception de la réponse
... |
fa797728-a52f-4cfc-aa61-5321e7c5baf0 | 7 | public boolean macheZug(Piece figur, int xPosEnd, int yPosEnd, Board boardObj){
Piece[][] board = boardObj.getBoard();
boolean possible = false;
boolean enemy = false;
if(this.testIfMoveAllowed(figur, xPosEnd, yPosEnd, board)){
//Testen ob Feld leer ist
if(analyse.testIfEmpty(xPosEnd, yPosEnd, board)){... |
f20b4094-3972-4c1c-8d22-217b10f287b6 | 5 | @Override
public void keyPressed(KeyEvent e) {
if(e.getComponent() != null) {
if(e.getComponent().getName().equals("codeBoxEdit")) {
if(e.getKeyCode() == KeyEvent.VK_ENTER || (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_V)) {
parent.addCodeToHistory();
... |
3305f401-ba82-4130-b8f6-0728ea488182 | 4 | public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (defaultType == null) throw new IllegalArgumentEx... |
2a794565-9c74-448e-a683-8d7a8a851d7e | 5 | @Override
public double simulate(AbstractStochasticLotSizingProblem problem,
AbstractStochasticLotSizingSolution solution)
throws ConvolutionNotDefinedException, SolvingInitialisiationException {
//Check the inputs
if (problem.getPeriods().length != solution.getAmountVariableValues().length)
throw new ... |
b3b867c8-7ebf-4c4d-8bbe-be7cfd5ca508 | 9 | private ShapedRecipe makeRecipe(String s) {
/*
shape: A-A,BBB,CDC
ingredients:
A: 1
B: 2
C: '5:2'
D: 57
result: 276
amount: 1
displayname: true
lore: "The vorpal blade\ngoes snicker-snack!"
enchantment: FIRE_ASPEC... |
22bff4eb-4cd3-4bb8-aed3-d331bed47ae1 | 4 | @Override
public void onMenuItemPressed(MenuPressedEventArgs param){
if (param.getMenuItem().getText() == Constants.ScrollOnText){
// turn on scrolling
List<Row> rows = this.logicalDocument.getRows();
this.logicalDocument = new ScrollableDocument(this.logicalDocument);
// this.logicalDocument = new Borde... |
4b879b47-7265-4909-a416-47e97443bf82 | 0 | public SocialProfileType(final String name) {
super(name);
} |
cc66dc83-8cc3-407f-930b-cd3260630a6e | 6 | public int maxSumDynamic(int[] array){
if(array==null || array.length==0 ) return 0;
if(array.length==1) return Math.max(array[0], 0);
int max=0;
int[] end=new int[array.length+1];
end[0]=0;
for(int i=0;i<array.length;i++){
//calc sequence that end at i
end[i+1]=end[i]<0?array[i]:end[i]+array[i];
... |
5366f493-2c0e-486f-a7fb-6405bce2ee53 | 2 | public void iterateFrame() {
if (currentKey != null) {
if (bPlaying) {
setCurrentFrame(currentFrame + currentKey.getFrameRate());
}
}
} |
05785a0d-d4af-49eb-a316-cec427bda239 | 2 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
iter = bucket.iterator();
while(iter.hasNext()) {
sb.append("(");
sb.append(iter.next().toString());
sb.append(")");
if(iter.hasNext()) sb.append(", ");
}
sb.append("]");
return sb.toString();
} |
2ee606c9-2faf-4bb1-bae0-7f14ff8d91d2 | 1 | public ByteBuffer read(int offset, int length) throws IOException {
ByteBuffer data = ByteBuffer.allocate(length);
int bytes = this.channel.read(data, offset);
data.clear();
data.limit(bytes >= 0 ? bytes : 0);
return data;
} |
2904703b-a5d3-4c98-8886-031e5d691347 | 7 | private void loadSecondLevelData() {
secondLevelRegions.clear();
secondLevelArcFlags.clear();
secondLevelRegionMap.clear();
partitioner.setMaxNodesPerRegion(levelTwoMaxNodes);
for (Set<DirectedGraphNode> firstLevelRegion : firstLevelRegions) {
final List<Set<... |
dc248398-b7d8-4220-ba30-c3ef72f1d914 | 7 | @Override
final public Expression evaluate(Expression leftSideOperand, Expression rightSideOperand)
{
if (Operator.outputMode == Calculate.OUTPUT_EXACT_MODE)
{
//try to use the operands as numbers, but treat them as expressions
//if they are not numbers
if (leftSideOperand instanceof Number && rightSideO... |
150ad0e4-d9e1-4ed6-903e-666e07830aa9 | 2 | @Override
public boolean equals(Object obj) {
if (obj.getClass() == this.item.getClass())
return this.item == (T)obj;
if (obj.getClass() == this.getClass())
return this == (TimeOutListItem<T>)obj;
return false;
} |
04831616-90c5-4ba8-b0a4-b1f55465c324 | 6 | public Object[][] rechercherStages(Region reg, Set<Competence> lesComps) {
ArrayList<OffreAffiche> lesOfrAffiche = new ArrayList();
Object[][] resultat;
ArrayList<Stage> lstStages = OffreNoyauFonctionnel.getTblStages().get(reg.getRegnom());
// System.out.println(lstStages + "|" + lstStag... |
a275b2d1-dd4f-4401-8a9e-afe38ec886fd | 1 | public static void main(String args[]){
int [] a={5,4,7,10,8,6,1};
a=sort(a);
for(int i=0;i<a.length;i++){
System.out.println(a[i]+" \t");
}
} |
26895d44-5c34-4de1-815f-3dfda44e020a | 7 | public CreateEmployeeJPanel(int m, boolean isDriver) {
list = new ArrayList<Employee>();
list2 = new ArrayList<Franchise>();
mode = m;
this.isDriver = isDriver;
initComponents();
if (mode ==0) //Add mode
{
listSelection.setEnabled(... |
bd8a8fe0-680a-45ea-ba1b-f10815a93a6c | 1 | public String toString() {
String res = "{\n";
for (Iterator<ZElement> e = enumElements(); e.hasNext();) {
res += e.next() + "\n";
}
return "}" + res;
} |
89e24620-994a-41b2-86a2-1a9ff7b67022 | 1 | protected Point2D getTextCenter( Parameters parameters ) {
Point2D base = getTextPosition( parameters );
double distance = getDistance( parameters );
if( distance == 0.0 ) {
return base;
}
Point2D normal = path.getNormalAt( getPosition(parameters) );
double x = base.getX() + distance * normal.getX();
... |
e52795d0-1c06-46e8-ac0c-6b090d1891dd | 7 | @Override
public void initialize(URL url, ResourceBundle resourceBundle) {
gameActive = true;
// Initialize the start time.
startTime = System.currentTimeMillis();
// Create our field.
field = new FieldModel();
field.addEventListener(new FieldEventListener() {
... |
1c82e7b4-b62e-463a-af84-dcc400e5a160 | 4 | private void dealtDamage(int getX, int getY, int getWidth, int getLength, int getTime, int getDelay, double getDamage,int applyForce)
{
if (character.equals("P1"))
{
if (moveDirection)
{
getWorld().addObject(new P1AttackArea(x + getX, y + getY,getWidth,getLeng... |
f84c5107-fdbe-4dd2-a8d4-306ee1c84352 | 1 | private boolean jj_2_73(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_73(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(72, xla); }
} |
dafa4c72-8dc6-43ea-8199-b41568fdee48 | 1 | public void setCaller(final MethodEditor caller) {
this.caller = caller;
if (caller.isConstructor()) {
this.firstSpecial = true;
} else {
this.firstSpecial = false;
}
} |
edfafc95-1e6b-4fd7-adfa-c29a0bcc3425 | 1 | public static Object factory(Object obj)
{
Class<?> classType = obj.getClass();
return Proxy.newProxyInstance(classType.getClassLoader(), obj.getClass().getInterfaces(),
new VectorProxy(obj));
} |
227197bb-0d0a-439f-9f23-77be23b48c3e | 2 | public static String formatString(String string, Object... args) {
// Replaces & with the Section character
string = string.replaceAll("&", Character.toString((char) 167));
// If there are arguments, %n notations in the message will be
// replaced
if (args != null) {
... |
44c8f3bf-5ab8-443b-b108-f9b5cf188f73 | 9 | public void createDiseaseForest(String fileName){
try{
BufferedReader er = new BufferedReader(new FileReader(fileName), 1024);
String curLine = er.readLine();
// The first line of a file should always be the first disease.
DiseaseNode diseaseHead = DiseaseNode.createDiseaseNode(curLine, null, null);
t... |
55d2cf6f-341c-420d-a324-436965c168cb | 7 | void getMap(final String keyMapFile)
{
greetingService.getMap(keyMapFile, new AsyncCallback<KeyMapData>() {
@Override
public void onSuccess(KeyMapData result) {
mapCode = result.getMapCode();
keyMap = result.getKeyMap();
Vector<MapDef> newMap = new Vector<MapDef>();
... |
b5210cde-80d9-489a-9275-abe1848219b3 | 9 | private int externalInterruptibleAwaitDone() throws InterruptedException {
int s;
ForkJoinPool cp = ForkJoinPool.common;
if (Thread.interrupted())
throw new InterruptedException();
if ((s = status) >= 0 && cp != null) {
if (this instanceof CountedCompleter)
... |
0f065bbc-494d-4e46-8445-097a44a9f124 | 5 | void filter(ArrayList<Integer> conditions, File input, File output){
//Filter a Hb/Hbo file with conditions listed in the last col
//Result only contains rows with conditions in conditions array
BufferedReader freader;
BufferedWriter fwriter;
try {
freader = new BufferedReader(new FileReader(input));
fw... |
89fc3c15-9924-4e81-852e-37fe13e8533a | 4 | public void setRow(Row row) {
if (row == null) {
throw new NullObjectInsertionException("Null row cannot be added");
}
if (this.row != null && !this.row.equals(row)) {
throw new ReassignObjectException("This Place already exists in another row. Cannot be reassigned");
}
if ( !row.exists... |
03d15e79-d9b6-499e-a6ae-b2dfdb742644 | 8 | private void setAliasXML(List<XMLTag> xml)
{
alias.clear();
for (final XMLTag piece : xml)
{
if((piece.tag().equals("ALIAS"))&&(piece.parms()!=null))
{
final String command=piece.getParmValue( "CMD");
final String value=piece.getParmValue( "VAL");
if((command!=null)&&(value!=null))
alias.p... |
c2cfe86b-c0a1-464c-8a35-1b290ad26f0f | 4 | public double rawPersonMaximum(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.variancesCalc... |
3c4a7134-f1fb-49b4-9ce9-05971fd3ab24 | 7 | private void confirmMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_confirmMouseClicked
// TODO add your handling code here:
Student usr = Database.db[Database.user];
if (!userName.getText().isEmpty() ){
usr.setUserName(userName.getText() );
}
i... |
16839476-016b-45a5-b0d5-e9caacf31f38 | 4 | public double characterEnergy()
{
if (P1character.equals("White"))
{
return whiteKnight.characterEnergy();
}
else if (P1character.equals("Bond"))
{
return jamesBond.characterEnergy();
}
else if (P1character.equals("Ninja"))
{
... |
7f16789f-14de-4c29-9ec5-abac9b608113 | 2 | private void initMovement() {
this.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
if (event.getClickCount() == 2) {
windowButtons.toogleMaximized();
}
}
});
this.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
publi... |
a12059cf-b308-43fa-8589-cdb4d055de49 | 4 | protected boolean pruefe_Attacke(Land angreifer, Land verteidiger, Spieler aktuellerSpieler){
if (!(angreifer.gib_besitzer()==aktuellerSpieler)) throw new IllegalArgumentException("Not the own country!");
if (angreifer.gib_besitzer()==verteidiger.gib_besitzer()) throw new IllegalArgumentExc... |
b5233815-5113-4a76-beee-7c1090d229b5 | 2 | @Override
public void setCourseName(String courseName) {
if(courseName == null || courseName.length() == 0) {
JOptionPane.showMessageDialog(null,
"Error: courseName cannot be null of empty string");
System.exit(0);
}
this.courseName = courseName;
... |
ae9af621-a501-495c-8258-45bac9295ef4 | 7 | private static void start() {
//get language from file
// 0 = english
// 1 = german
// else = system
Short langs = getPrefsFromFile();
if(langs==0){
lang="en";
} else if (langs==1) {
lang="de";
reg ="DE";
} else if (langs==2) {
lang="system";
} else {
lang="system";
}
setLookAndFe... |
b26a87f3-ffbb-41ec-aa25-dce472de801b | 2 | void drawM(Graphics2D g2d, Rectangle rect, int number) {
if (number < 0) {
draw(g2d, rect, -number);
return;
}
int b8 = number % 8;
if (b8 < 5) {
BrutalRenderer.renderSprite(g2d, rect, image, wSize, hSize, pad, number / 8 * 5 + b8);
}
... |
e6edf143-128c-45d5-af0b-3d5f0c2f1bf0 | 5 | public static Set getTerminalProductions(Grammar grammar) {
Set terminalDerivers = new TreeSet();
Production[] p = grammar.getProductions();
for (int i = 0; i < p.length; i++) {
String lhs = p[i].getLHS();
if (terminalDerivers.contains(lhs))
continue;
String rhs = p[i].getRHS();
for (int k = 0; k ... |
089b2537-6754-455d-be84-6e2c9ae43693 | 1 | @Override
public final void interrupt() {
try {
receivingSocket.leaveGroup(multicastAddre);
} catch (IOException e) {
System.out.println("Error leaving group");
}
receivingSocket.close();
super.interrupt();
} |
8195537b-122b-4b28-8ae4-62b245f512c3 | 8 | public Token nextToken() throws LexicalError
{
if ( ! hasInput() )
return null;
int start = position;
int state = 0;
int lastState = 0;
int endState = -1;
int end = -1;
while (hasInput())
{
lastState = state;
stat... |
65758289-af0b-45c9-a6a3-0acafc46218a | 8 | @SuppressWarnings("unchecked")
/*pkg*/ <S> S findCachedService(Class<S> serviceClass, Scope scope) {
assert serviceClass!=null:
"Parameter \"serviceClass\" cannot be null";
assert scope!=null:
"Parameter \"scope\" cannot be null";
Object result=null;
switch (scope) {
case REQUEST: {
// Look in... |
b53972f8-6aaa-4e4e-b678-2ae1c4acc5d2 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE> ... |
be9db93b-858b-49c7-9549-584157bcc4f6 | 3 | public static void main(String[] args) {
Socket connectionSocket;
try (ServerSocket welcomeSocket = new ServerSocket(PORT_NUMBER);) {
while (true) { // Server sollten immer laufen, vielleicht einen
// quit-befehl einbauen?
System.out
.println("Chat Server: Waiting for connection on TC... |
40c80ba6-7cc0-4f75-9739-d686363ac592 | 3 | public LookAheadIS(InputStream in, int size) throws IOException
{
if (size < 1)
throw new IllegalArgumentException();
this.in = in;
buffer = new byte[size];
for (bsize = 0; bsize < size; ++bsize)
{
int read = in.read();
if (read == -1)
break;
buffer[bsize] = (byte) read;
}
offset = 0;
} |
ba47a4b7-912f-4999-bbfe-7a2360d1aafd | 2 | public circularLinkedList(char[] charArray) {
char firstChar = charArray[0];
head = new circularLinkedListNode(firstChar);
nodeCount = 1;
circularLinkedListNode tail = head;
for (int i = 1; i < charArray.length; i++) {
char curChar = charArray[i];
// if char exists, add loop;
circularLinkedListNode ... |
289b2ce5-b37f-4341-be0a-550efae485d9 | 8 | public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argument... |
d0cb0850-ba83-4349-968e-90e9d91bab08 | 3 | @Override
public void doAction(Player player, Grid grid) throws InvalidActionException {
if (player.getRemainingTurns() <= 0)
throw new InvalidActionException("The player has no turns left!");
Position currentPos = player.getPosition();
Position newPos = new Position(currentPos.getxCoordinate() - 1, curren... |
5160f3c0-94fc-4bf4-895b-49c88af39b52 | 3 | public void checkStatus()
{
try
{
PreparedStatement stmt = connection.prepareStatement("select sum(s1.total) as total from sale s1 " +
"where trim(s1.cid) = trim(?) " +
"and (select count (s2.order_id) " +
"from sale s2 " +
"where s2.tstmp > s1.tstmp " +
"and s1.cid = s2.cid ) < 3 ");
... |
be08bdff-5f58-421a-9912-339f219c0589 | 8 | private void findSolutions(int row,
int col,
RuzzleSolution current,
ArrayList<RuzzleSolution> currentSolutions)
{
if(row < 0 || row >= RuzzleBoard.NUM_ROWS) return;
if(col < 0 || col >= RuzzleBoard.NUM_C... |
8c769be5-1d42-46a6-a69c-0bbcc45927ea | 1 | public static CSTable getTable(final CSProperties p, String boundName) {
MemoryTable m = new MemoryTable();
List<String> arr = keysByMeta(p, "bound", boundName);
for (String a : arr) {
}
return m;
} |
952fac2d-34fc-4d08-a92e-f201910b02c6 | 0 | public int[] quickSort(int[] array) {
return array;
} |
0c25293b-4d72-4df8-beed-a35fb9d6a5b1 | 5 | public void continueGoing(){
if (!going)
return;
if (goThread!=null){
goThread.interrupt();
}
Runnable runnable = new Runnable() {
@Override
public void run() {
while(curSong<songLines.length){
if (!canContinue()){
break;
}
String songLine = songLines[curSong];
if (!Str... |
3433c932-cad7-40b2-bdc2-7426b7dd3e82 | 1 | public void setMonthlySalary(double monthly)
{
if (monthly < 0)
monthlySalary = 0.0;
else
monthlySalary = monthly;
} |
413a451f-f155-45fb-8f00-986dfbf92d23 | 3 | public boolean buy() {
String kiosk = Utils.getString("kiosk/");
Output.printClock("Kaufe Tagesgericht", Output.INFO);
Control.sleep(5);
int i = kiosk.indexOf("fleispunkte");
if (i == -1) {
Output.println(": Fehler", Output.INFO);
return false;
}
kiosk = kiosk.substring(i);
int punkte = Intege... |
bb98a2e4-c7f5-42a8-8362-9ac88abc73de | 4 | public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
System.out.println("Введите 1 - для горизонтали,");
System.out.println("Введите 2 - для вертикали:");
int a = scn.nextInt();
int b = 0;
int c = 0;
if (a==1) {
while (b<10){
System.out.print(8);
b++;
}
}
... |
09d4412a-d4f9-489f-8bcb-da5dba504098 | 1 | public UserStorageAccess() {
try {
File fXmlFile = new File(fileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(fXmlFile);
doc.getDocumentEl... |
4357b3b7-e800-423a-8825-18a9e176cb32 | 2 | public void connect() {
getLogger().info("Attempting connection...");
try {
new IRC(new Socket(getConfig().getString("server.host"), getConfig().getInt("server.port")), this);
} catch (UnknownHostException e) {
handleDisconnect();
} catch (IOException e) {
... |
17e766fc-c104-4b44-977b-4d60d7b74d56 | 2 | private void testExistingMethod(MethodInfo newMinfo)
throws DuplicateMemberException
{
String name = newMinfo.getName();
String descriptor = newMinfo.getDescriptor();
ListIterator it = methods.listIterator(0);
while (it.hasNext())
if (isDuplicated(newMinfo, name, ... |
08a3e7b6-410b-4c14-9aa8-f013de00fbf6 | 1 | private final static void submitArtistTasks()
throws MasterException {
try {
//submit tasks to do.
//Waiting until all tasks are done
MasterMetadata.artistES.invokeAll(MasterMetadata.artistTasks);
//Clean the queue
MasterMetadata.artistTasks.clear();
} catch (Exception e) {
thro... |
e16f06bc-b357-454a-a379-a38f44aabc4e | 1 | private static boolean insertPrescription(Prescription bean, PreparedStatement stmt) throws SQLException{
stmt.setDate(1, bean.getStartDate());
stmt.setDate(2, bean.getThisDay());
stmt.setString(3, bean.getDose());
stmt.setInt(4, bean.getQuantity());
stmt.setInt(5, bean.getRefill());
stmt.setDate(6, bean... |
6c535199-a3f0-4009-8ee3-61f6616a8bde | 8 | public static void loadPlatform(File f) throws FileNotFoundException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class syscl... |
0769a1c5-9f86-43ad-a131-f6a49bd300d9 | 4 | public boolean hasAllWalls(){
if((east()== true )&& (west()== true) && (north()== true) && (south()== true)){
return true;
}
return false;
} |
8776fe23-2df3-4739-b4b4-964a4e039510 | 0 | protected void onOp(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} |
228b0922-4f91-42e8-b1bc-497f7f5d8213 | 4 | public void addChild(IXMLElement child) {
if (child == null) {
throw new IllegalArgumentException("child must not be null");
}
if ((child.getName() == null) && (! this.children.isEmpty())) {
IXMLElement lastChild = (IXMLElement) this.children.get(this.children.size() - 1)... |
302f6176-3e2a-49ef-b5ef-6b4ebb692494 | 9 | public GeoCoder() {
this.locations = new ArrayList<Location>();
//read zipcode geolocation file
String line = "";
String fileToParse = "postcode_NL.csv";
Scanner inputStream = new Scanner(GeoCoder.class.getResourceAsStream(fileToParse));
while (inputStream.hasNextLine() ) {
line = inputStream.nextLi... |
5826b01b-af5a-460b-a84c-4ca02a87c47f | 9 | public void update(){
if(x < DownGame.GAME_WIDTH/2 && DownGame.jumpl2r ==1){
jumpl2r();
}
else if(x > 0 && DownGame.jumpr2l == 1){
jumpr2l();
}
if(x > 0 && x < DownGame.GAME_WIDTH/2){
DownGame.StickMan1isOnLeft = false;
DownGame.StickMan1isOnRight = false;
}
if(x == DownG... |
38f9cad6-c2d5-4b9d-b99c-2fef4190c639 | 7 | public void update()
{
if(!bombExplode)
{
timerReset--;
if(timerReset <= 0)
bombExplode = true;
}
else
timerReset=120;
if(!rivalsUpdated)
{
rivalsUpdated = true;
Element e;
for(int i = 0; i < listElements.size(); i++)
{
e = listElements.get(i);
if(e != this && e.getTyp... |
17202edf-5cf7-49ca-a691-10d258930b56 | 5 | public Measure(String measureDefinition) {
measureType = null;
beats = new ArrayList<SongEvent>();
try {
if (measureDefinition.length() < 2) {
throw new Exception("Invalid measure definition: " +
measureDefinition);
}
switch (measureDefinition.charAt(0)) {
case 'm':
measureType = Me... |
36904a50-c14e-4e9e-aed6-c1b1385d939c | 6 | protected void addProperty(Map<String, List<String>> props) {
StringBuilder propName = new StringBuilder();
char c = nextChar();
if (isSyntax(c) || index >= contents.length()) {
return ;
}
while (!isSyntax(c) && index < contents.length()) {
if (c != '\n' && c != ' ') {
propNam... |
39678178-39e2-41da-acd7-af9477505c39 | 1 | public Teams getOther()
{
if(this == BLUE)
return PURPLE;
return BLUE;
} |
4b69e205-3634-40cd-883a-d23a0a28cb1f | 1 | public SoundTests() {
super("soundTests");
controls = new GameLayer("soundControls");
String buttonFont = Configuration.GUI.Fonts.BUTTON_FONT;
int buttonWidth = 270;
int buttonHeight = 40;
GameButton stopSound = new GameButton("stopSound",
GameAssetManager.getInstance().getClonedObject(GameFont.c... |
6bc1a4e3-c6dc-410c-970b-820689e41938 | 9 | * @return True if the unit was cashed in (and disposed).
*/
public boolean checkCashInTreasureTrain(Unit unit) {
if (!unit.canCarryTreasure() || !unit.canCashInTreasureTrain()
|| !requireOurTurn()) {
return false; // Fail quickly if just not a candidate.
}
boole... |
ab4cd490-3b24-4242-af26-7771649c0d16 | 2 | public Stock getStockTicker(String tick){
for (int i = 0; i < stocks.size(); i++){
if (stocks.get(i).getTicker().equals(tick))
return stocks.get(i);
}
return null;
} |
d2267e90-37ab-4450-8bb6-f767451bfcdf | 2 | public static void writeMeshToObj(String objPath, String mtlPath, Mesh mesh)
throws IOException {
// obj
PrintWriter writer = new PrintWriter(new FileWriter(objPath));
Vector3d[] vertices = mesh.getLocalVertices();
Triangle[] triangles = mesh.getLocalTriangles();
writer.println("mtllib "
+ mtlPath.sub... |
53b79308-a952-4d79-aff1-c60d95716129 | 4 | public static long getMaxRectangleSum() {
int ROWS = m.length, COLS = m[0].length;
long[] comp = new long[ROWS];
long maxSum = Long.MIN_VALUE;
topRow = topCol = bottomRow = bottomCol = 0;
for (int left = 0; left < COLS; left++) {
Arrays.fill(comp, 0);
for (int right = left; right < COLS; right++) {
... |
55d01129-b320-42e7-9b91-e1f4ad6076ae | 9 | public Number multiplyRemoveZero(Number other, int length) {
final Number res = new Number(length);
if (getFilledLength() == 0 || other.getFilledLength() == 0) {
return res;
}
int i = 0;
long carry = 0;
int diff = 0;
while (i - diff < length) {
... |
c5665db7-6c51-41a9-a474-ba1d912a761d | 5 | protected void setDestination(short instruction) throws ProgramException {
boolean destA = (instruction & 0x0020) > 0;
boolean destD = (instruction & 0x0010) > 0;
boolean destM = (instruction & 0x0008) > 0;
if (destM) {
int address = A.get();
if (address < 0 || address >= M.getSiz... |
545abc60-005d-4bc2-8027-1796a9d62c27 | 5 | @Override
public void setBackground(final Color bg) {
super.setBackground(bg);
if (this.inner != null) this.inner.setBackground(bg);
if (this.coxeter != null) this.coxeter.setBackground(bg);
if (this.schoenflies != null) this.schoenflies.setBackground(bg);
if (this.orbifold != null) this.orbif... |
9312a324-dd75-446a-a7df-ba1c66b4871d | 0 | public void setHeight(Double height) {
this.height = height;
} |
a70d9d13-722a-47c4-b20c-f62a3d265eac | 3 | private void addAnswersTable() {
tablePanel = new JPanel();
tableModel = new DefaultTableModel(new String[] { "Treść odpowiedzi","ID"}, 0);
tablePanel.setBounds(23, 286, 518, 203);
tablePanel.setLayout(new BorderLayout());
table = new JTable(tableModel);
header = table.getTableHeader();
table.getColumn... |
c3ec5b36-076b-434f-aa0d-0971a6cd0e03 | 2 | protected void closeReaders() throws IOException {
if (readersToClose != null) {
for (final Reader r : readersToClose) {
r.close();
}
}
} |
db99f3af-14c1-45b5-8e41-d2d801bd0e81 | 9 | public static EatWorldMap loadData1(Main mainContext, String fileName) {
String everything = null;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(fileName));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb... |
722284b4-0894-45a7-b691-d91730f377af | 2 | private void displayAttacks(){
if (friendAttacks != null){
DefaultListModel listModel = new DefaultListModel();
for(Attack attack : friendAttacks){
listModel.addElement(attack.getDisplay());
}
this.jlstFriendAttacks.setModel(li... |
1ca6618b-4da2-4833-acfc-235af95c2a8b | 6 | public static void main(String[] args) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
83bfb8f9-1040-4c76-a41b-831aca13d52b | 0 | public void setjLabel7(JLabel jLabel7) {
this.jLabel7 = jLabel7;
} |
19b7f159-a605-427d-a5b0-b70a4b468138 | 1 | public static Venue findOne(String key, String value) throws SQLException {
ResultSet result = Data._find(Venue.class.getSimpleName(), key, value);
Venue rtn = new Venue();
if(!result.next()) {
return null;
}
rtn = Venue.createOneFromResultSet(result);
return rtn;
} |
39280d00-5d7d-48c1-a1c4-5a2907199bd0 | 4 | public void play(InputStream source) {
int bufferSize = format.getFrameSize() * Math.round(format.getSampleRate() / 10);
byte[] buffer = new byte[bufferSize];
SourceDataLine line;
try {
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
line = (SourceDataLine) AudioSystem.getLine(info);... |
29b5281e-5350-496c-a4f5-1aa6bdfd9fc8 | 0 | public String[] getEventDescription() {
return eventDescription;
} |
eb84e470-a2ec-4411-8754-7428e3948f60 | 7 | public boolean simulateInput(String input) {
/** clear the configurations to begin new simulation. */
myConfigurations.clear();
Configuration[] initialConfigs = getInitialConfigurations(input);
for (int k = 0; k < initialConfigs.length; k++) {
PDAConfiguration initialConfiguration = (PDAConfiguration) initia... |
253aecac-e4d8-4948-b417-906f489230af | 4 | private void drawGrid(Graphics g) {
int xp = WIDTH / 2 - boxSize * lines;
int yp = HEIGHT / 2 - boxSize * lines / 2;
boxX1 = xp;
boxX2 = (boxX1 + boxSize * lines);
boxY1 = yp;
boxY2 = (boxY1 + boxSize * lines);
g.setColor(new Color(0));
for (int y = 0; y < lines + 1; y++) {
int ya = yp + boxSize * y... |
6e1b23a3-273f-4d65-9cf6-eb0e12b568dd | 2 | public double[] getTurningPointConcns(){
double[] ret = null;
if(this.nTurningPoints>0){
ret = new double[this.nTurningPoints];
for(int i=0; i<this.nTurningPoints; i++)ret[i] = this.interpolationConcns[this.turnIndices[i]];
}
return ret;
} |
25c985ca-7b39-446d-b894-e1d1793be535 | 4 | public Deer getClosestDeer(double distance)
{
// get the head of the deer linked list
Deer head = Deer.getHead();
Deer curr = head;
Deer closest = null;
double closestDistance = 0;
double currDistance = 0;
// loop through the linked list looking for the closest deer
while (cu... |
9a269284-17ac-41cc-8cf4-ec4c74efc0f6 | 9 | public void add(Bitemporal newValue) {
sanityCheck();
Collection<Bitemporal> toEnd = new HashSet<Bitemporal>();
Collection<Bitemporal> toAdd = new LinkedList<Bitemporal>();
for (Bitemporal possibleOverlap : getHistory(TimeUtils.now())) {
if (newValue.getValidityInterval().overlaps(possibleOverlap.getVali... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.