method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d8934dcb-4857-4087-a642-dc209e0b0744 | 8 | public void storeFinalGrades(int term){
try {
// Connect
HttpGet finalGet = new HttpGet("https://jweb.kettering.edu/cku1/wbwskogrd.P_ViewGrde?term_in=" + term + "&inam=on&snam=on&sgid=on");
HttpResponse response = this.clientBanner.execute(finalGet);
String html = HTMLParser.parse(response);
... |
44e2fbfd-8da0-457b-855e-09b1b17daa09 | 3 | private Map<Pattern,String> loadPatterns(InputStream is) {
Properties p = new Properties();
try {
p.load(is);
} catch (IOException e) {
throw new RuntimeException("Error loading patterns", e);
}
Map<Pattern,String> pattMap = new HashMap<Pattern,String>();
for (Object k : p.keySet()) {
String key... |
358f155a-8904-4014-8ed8-68dd0a528c53 | 7 | public void initialize() {
setTitle("Manage Teams");
setBounds(100, 100, 464, 362);
getContentPane().setLayout(new BorderLayout());
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().ad... |
90065346-d48f-4000-8a84-d34444d0b70d | 5 | private void afficherModifierFormation() {
System.out.println("Code de la formation à modifier ?");
this.modeleApplication.afficherLesFormations();
String code = scan.nextLine();
while(code.isEmpty()) {
System.out.println("Veuillez entrer un code de formation correct.");
... |
d537d3b2-4a5e-480a-84ee-05e2f1a0c0b7 | 3 | private void jButtonVoteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVoteActionPerformed
SondageReponseDao srd = SondageReponseDao.getInstance();
List<SondageReponse> listReponses = srd.findAll();
SondageReponse sr_vote = new SondageReponse(lastSondage.getId(), las... |
dcb0a277-3447-48d3-ba7b-8a0923eff145 | 5 | private final void method3067(byte i) {
int i_5_ = 25 / ((i - -28) / 57);
if ((((Class348_Sub40_Sub8) this).anInt9149 ^ 0xffffffff) < -1) {
aShortArray9162
= new short[((Class348_Sub40_Sub8) this).anInt9150];
aShortArray9159
= new short[((Class348_Sub40_Sub8) this).anInt9150];
for (int i_6_ = 0; ((... |
563fcebf-a217-49cb-810f-60b5701545d9 | 3 | public void creationCarte(final int[][] carte)
{
this.carte = new int[carte.length][carte[0].length];
for (int i = 0; i < carte.length; i++) {
for (int j = 0; j < carte[i].length; j++) {
this.carte[i][j] = carte[i][j];
}
}
for (final IleEcouteur ileEcouteur : this.ileEcouteurs.getListeners(IleEcoute... |
dc4d6d5c-5b65-4246-a194-a0bd85544a7b | 0 | public int getMsgFormat() {
return MsgFormat;
} |
d2544e6e-71d8-45d3-8b8c-91d63437a537 | 2 | public static DayEnum fromValue(String v) {
for (DayEnum c: DayEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
e81d9610-e9ba-407c-8e6a-55351c29cf6e | 8 | @SuppressWarnings("rawtypes")
public void buildList(JSONObject jo) {
//build from the JSONObejct a arrayList with stops
try{
if(!jo.isEmpty()) {
Set set = jo.entrySet();
Iterator i = set.iterator();
int data = set.size();
int total = 25;
double current = StartUpLoader.getInstance().get... |
b4334cfb-c611-4398-8222-74c47dc14394 | 7 | public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)pa... |
5b44e2dc-2854-44c7-b21c-34b3ef638785 | 1 | private void writeResultGlobal(ValidateResult[] validateResultsSingle, ValidateResult globalResult, String filepath) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(new File(filepath)));
out.write(ValidateResult.getCaption());
out.newLine();
for (ValidateResult validateResult : vali... |
23233b37-949d-4078-b715-ff79a789d965 | 5 | public static String findTextInList(List<WebElement> webElements, String ans){
Point sLocation;
int xx, yy, d;
String text;
for(WebElement ss : webElements){
text = ss.getText();
if(text!=null && !text.equals("")){
sLocation = ss.getLocation();
... |
1522cb04-8ff5-4df5-a026-fe4551a4b060 | 7 | @Override
public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) {
values[ref] = 0.0;
values[alt] = 0.0;
int refCount = 0;
int altCount = 0;
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while(it.hasNext()) {
MappedRead read = it... |
90669e94-8813-42ce-898a-49d1716f1b45 | 7 | @Override
public void process(WatchedEvent event) {
try {
final String eventPath = event.getPath();
switch (event.getType()) {
case None:
final Event.KeeperState state = event.getState();
logger.info("new ZK connection stat... |
1944bad3-1f40-48b8-ab86-f50d4d6cff03 | 9 | public void focusGained(FocusEvent e) {
try{
if(e.getSource() == txtAreaTeam1){
if(blnServer){
for(int i = 0; i < player.size(); i++){
tempPlayer = (PlayerConnection)player.get(i);
if(tempPlayer.intID == intID){
tempPlayer.intTeam = 1;
updateTeams();
}
}
}else{
... |
ac52cb46-533a-42cd-baa6-c7a671f0723a | 3 | @SuppressWarnings("unchecked")
public Map<String, Object> getStateForPlayerId(String playerId) {
Map<String, Object> result = Maps.newHashMap();
for (String key : state.keySet()) {
Object visibleToPlayers = visibleTo.get(key);
Object value = null;
if (visibleToPlayers.equals(ALL)... |
9931c1ee-1f57-461d-9dc3-416d7be36e5a | 9 | public static List<FunctionTrace> extractRelevantSequence(
List<List<FunctionTrace>> llft) {
List<FunctionTrace> relevantSequence = null;
Iterator it = llft.iterator();
List<FunctionTrace> lft = null;
List<FunctionTrace> finalFunctionTrace = new ArrayList<FunctionTrace>();
boolean foundErrorTrace = false;... |
b437f44b-a2f3-4c01-8d0b-359bbd59640c | 2 | public void cleanUp()
{
try
{
synchronized (this.mutex)
{
while (!pool.isEmpty())
{
pool.get(0).setTaken(true);
Connection c = pool.get(0).getConnection();
c.commit();
//this is a workaround for a bug in some databases that
//won't properly close connections if they're ... |
bd5db852-78c6-473a-8443-99315e282e29 | 1 | void drawSelected(int x, int y, double w, double h) {
if (Main.isBlinked) {
final int border = (int) Math.round(w / 50.0 + 0.5);
g.setColor(SELECTED_COLOR);
g.fillOval(x - border, y - border, (int) w + 2 * border, (int) h + 2 * border);
}
} |
e89a62c2-eac6-4823-bf98-7e205ebf8225 | 2 | @Override
public boolean equals(Object object) {
if (super.equals(object)) {
NBTTagList nbttaglist = (NBTTagList) object;
if (this.type == nbttaglist.type) {
return this.list.equals(nbttaglist.list);
}
}
return false;
} |
4e589578-215e-45b3-81ad-fa528f27f89c | 6 | public void beginRO(String transactionName, long startTime) {
if( transactionMap.containsKey(transactionName) ) {
writeToStreamln("Transaction with same name already"
+ "exists");
return;
}
String output = new StringBuilder("Read only Transaction ")
.append(transactionName... |
ce944d9d-a998-4318-a485-8d00ec1ec50b | 0 | @Override
public String toString() {
String desc;
desc = "id3v2TagRestrictions = "+Integer.toBinaryString(getBitmap(null));
return desc;
} |
600ff051-4083-40b9-bd8a-ee86fb851622 | 0 | public LayoutStorageAction(String saveString, String restoreString, Automaton a) {
super(saveString, null);
automaton = a;
restoreAction = new AutomatonAction(restoreString, null) {
public void actionPerformed(ActionEvent e) {
graph.moveAutomatonStates();
}
};
restoreAction.setEnabled(false); ... |
41fa3b22-9e6e-43ce-bf73-cc4ebe177605 | 0 | public String getOldValue(){
return oldValue.getText();
} |
4132ea60-90c8-4385-b801-49c65152fdaa | 5 | public int PrintAge() {
Calendar today = Calendar.getInstance();
Calendar birthDate = Calendar.getInstance();
int age = 0;
birthDate.setTime(this.DOB);
if (birthDate.after(today)) {
throw new IllegalArgumentException("Can't be born in the future");
}
age = today.get(Calendar.YEAR) - birthDate.get(Cale... |
1cb34f3a-ab2d-4fea-b2e1-2f0fb92a5d4b | 4 | public boolean validRay(RayIntersect intersect){
if(intersect == null || Double.isNaN(intersect.getX()) || Double.isNaN(intersect.getZ()) || intersect.getDistance() == 0){
return false;
}
return true;
} |
266c0987-9d6f-43df-a72b-fb6d932c4e62 | 1 | private void displayNext() {
try {
refresh(ekd.next(ek));
} catch (NoNextEmailKontaktFoundException e) {
JOptionPane.showMessageDialog(this, e.getMessage());
e.printStackTrace();
}
} |
857b6afe-f840-4344-9909-243c811433b8 | 8 | public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
// require an owner type if the raw type needs it
if (rawType instanceof Class<?>) {
Class<?> rawTypeAsClass = (Class<?>) rawType;
boolean isStaticOrTopLevelClass = Modifier.isStatic(rawTypeAsClass.getModifie... |
29376164-17f5-4bf9-8936-043dbef78887 | 1 | private static void register(Transition transition) {
List<Transition> list = transitions.get();
if (list == null) {
list = new ArrayList<Transition>();
transitions.set(list);
}
list.add(transition);
} |
472dfa0f-3730-40e3-bcad-7584910c2630 | 7 | @Override
public boolean equals(Object value) {
if(value instanceof Type){
Type t = (Type) value;
boolean r = true;
r = r && getType().equals(t.getType());
if(getKeyType() !=null){
r = r && getKeyType().equals(t.getKeyType());
}
if(getValueType()!=null){
r = r && getValueType().eq... |
bfd91d86-e24f-490d-aa82-cb8a56160207 | 5 | private void dessinerFormesNonTriees(Graphics graphique)
{
Noeud courant = GestionnaireForme.getInstance().getPremierNoeud();
if(courant != null) {
while (courant != null) {
graphique.setColor(courant.getForme().getCouleur());
if (courant.getForme() instanceof Rectangle)
{
Rectangle re... |
3f813fd9-7f7b-427c-85f7-bf465411ec34 | 7 | private void dispatch(String[] commands, PrintWriter writer) {
switch (commands[0]) { //first element of string array must be one of the accepted commands
case AppConstants.ADD:
if (commands.length != 3) {
LOG.warning("Insufficient number of parameters in ADD com... |
3a275cf3-7b68-4861-9318-631bd47809bf | 9 | public Entity(EntityType t1,Level l1){
t=t1;
l=l1;
sp = new Sprite(t1);
switch(t){
case BAT:
health=15;
break;
case PLAYER:
health=25;
break;
case SNAKE:
health=25;
... |
bad1d3bd-69be-411a-b956-f32b238ebadc | 5 | @Override
public List<Event> findEventAll() {
List<Event> list = new ArrayList<Event>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_ALL);
... |
e73121f3-8417-4b5c-a3c2-9fa8797b4f55 | 7 | private void method289(Object5 class28)
{
for(int j = class28.anInt523; j <= class28.anInt524; j++)
{
for(int k = class28.anInt525; k <= class28.anInt526; k++)
{
Ground class30_sub3 = groundArray[class28.anInt517][j][k];
if(class30_sub3 != null)
{
for(int l = 0; l < class30_sub3.anInt1317; l... |
364fd82e-1f1d-4d13-a8c3-a9316cbbadb4 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
5b3ee280-7370-44fa-aee6-996f4c23fa65 | 2 | private static boolean settNode(int j, int[] noderSett) {
for (int i : noderSett) {
if (i == j) return true;
}
return false;
} |
36a11874-44bb-4cae-a816-50f457f1e1a3 | 9 | public static void main(String[] args) {
int l=0;int r = 5;int u = 1;int d = 5;
int n=0;
int[][] arr = {{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5}};
int i=0,j=0;
int m = 1;
int num = r*d;
while (n< num){
n++;
switch(m){
case 1:
if(j<r-1){
System.out.println(arr[i][... |
0afd1527-0fb8-451a-96f7-7c6366ebcf85 | 6 | public void selectionInteract(int x, int y)
{
for (Inventory inventory : inventorys) {
if (inventory.getX() >= x && inventory.getY() >= y && inventory.getX() - 20 <= x && inventory.getY() - 20 <= y ) {
if (inventory.getQuantity() > 0) {
holdingItem = !holdingItem;
... |
6320fee6-089b-48e3-b49b-446e902bc62b | 1 | @Override
public void open(String name) throws ChannelException {
try {
Socket socket = new Socket(host, port);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
receiver = new Recei... |
bcfc8e49-772e-47f7-83af-6e1af547992f | 7 | public void run() {
// get line and buffer from ThreadLocals
SourceDataLine line = (SourceDataLine)localLine.get();
byte[] buffer = (byte[])localBuffer.get();
if (line == null || buffer == null) {
// the line is unavailable
return;
... |
81a1d649-9ec8-4073-8f42-737fb31c18c6 | 9 | protected boolean setEmoteType(String str)
{
str=str.toUpperCase().trim();
if(str.equals("BROADCAST"))
broadcast=true;
else
if(str.equals("NOBROADCAST"))
broadcast=false;
else
if(str.equals("VISUAL")||(str.equals("SIGHT")))
emoteType=EMOTE_TYPE.EMOTE_VISUAL;
else
if(str.equals("AROMA")||(str.e... |
a4bcd5db-a6ae-453d-9a56-a374817ae230 | 2 | public void jump() {
Cell[][] grid = this.landlord.getGridPanel().getGrid();
// -2 because of fences on the sides
int width = this.landlord.getGridPanel().getW();
int height = this.landlord.getGridPanel().getH();
// +1 because of the fence on the side
int x = (int) (Math.random() * width);
int y = (int) ... |
a63ec0bc-4435-4f6a-ae49-7c87c1508b4b | 5 | */
private boolean checkSessionLapRawData() {
// Gestion des flashbacks dans le même tour, bug
// FIXME : Not Working
boolean ret = true;
try {
if (this.curRawDataSet != null
&& this.curRawDataSet.size() > 0
&& this.curRawDataSet.last().getLap().equals(this.curRawData.getLap())
&& this.curRaw... |
309eadaa-646c-41f0-bc9a-77fd015137c2 | 2 | public void sendDebug( String d ) // Temporary Method to send debug
// information to my username.
{
for ( Player p : getServer().getOnlinePlayers() )
{
if ( p.isOp() )
p.sendMessage( ChatColor.DARK_AQUA + "[iNations Debug] " + ChatColor.WHITE + d );
}
} |
b663fce9-8030-486c-8174-88077c737574 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Servico)) {
return false;
}
Servico other = (Servico) object;
if ((this.id == null && other.id != null) || (thi... |
ff45db2f-434a-4a03-972b-1dc2f5f6b7ec | 2 | private int getMinIndex(char[] arr, int i) {
int minIndex = i;
for (int j = i + 1; j < arr.length; j++) {
if (arr[j] < arr[minIndex])
minIndex = j;
}
return minIndex;
} |
799c8c76-cd8a-4857-bfa5-8dfec47b9cf4 | 1 | private Window wdg() {
Widget wdg = UI.instance.getWidget(remote_id);
if (wdg instanceof Window) {
return (Window) wdg;
} else {
return null;
}
} |
ca5882c7-0dd2-44cd-b19e-9f6f9e1c7444 | 0 | @Test
public void findDuplicateTypeHand_whenTwoPairsExist_returnsTwoPairPlusHighestKicker() {
Hand hand = findDuplicateTypeHand(twoSixesTwoFoursAceKicker());
assertEquals(HandRank.TwoPair, hand.handRank);
assertEquals(Rank.Six, hand.ranks.get(0));
assertEquals(Rank.Four, hand.ranks.get(1));
assertEquals(Rank... |
4aaf2bf8-cee9-47d6-a39d-d50c8ed312f6 | 2 | private String getStrFromInputStream(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder response = new StringBuilder();
String inputLine;
try {
while ((inputLine = reader.readLine()) != null) {
... |
e954521a-ab21-4e7d-aacf-1071eb574272 | 3 | public void update()
{
Vector3f playerDistance = transform.getPosition().sub(Transform.getCamera().getPos());
Vector3f orientation = playerDistance.normalized();
float distance = playerDistance.length();
float angle = (float)Math.toDegrees(Math.atan(orientation.getZ()/orientation.getX()));
if(orient... |
aad74d8c-29ef-4ecd-9668-a0534d6a42b8 | 6 | public World isAndGetCopyWorld(World world, Player player){
String playerName = "_" + player.getName();
new_name = world.getName();
folderName = "/" + new_name;
if (!(new_name.endsWith(playerName))){
new_name = new_name + playerName;
if (plugin.mainWorlds.contains(world.getName())){
if (playerWorld... |
83d17bd8-6655-4953-a42c-ac3be5cb20d1 | 9 | @Override
public String toImplementationSyntax(TableModel tableModel, String definition)
{
String newDefinition = definition;
StringTokenizer tokens = new StringTokenizer(newDefinition,
getSyntax().getDelimiters());
String token;
String cellID = n... |
d78fbaba-adb3-4467-95ff-eb0452374597 | 5 | public static PathConvexShape findGroundShape(Point3f guyPosition, PathLevel pathLevel) {
List<PathConvexShape> pathConvexShapeList = pathLevel.getPossibleShapes(guyPosition.x, guyPosition.z);
if (pathConvexShapeList == null) {
return null;
}
double highestPossibleY = guyPos... |
1314a57b-dceb-4d36-90c3-f641fb61c6cd | 1 | public void progressStart()
{
if (block == 0) {
}
++block;
} |
d906806b-4c1b-4381-b2e5-c67aac0b08e1 | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
85b4c186-ecd1-4e72-b80c-fe0576994582 | 2 | public void renderWorld(){
for(int y = 0; y < worldHeight; y++){
for(int x = 0; x < worldWidth; x++){
Tile tile = Tile.getTileById(mapData.get((y * worldHeight) + x));
tile.render(x * tileSize, y * tileSize);
}
}
renderLights();
renderSides();
renderEntities();
} |
9b3879e3-35ae-452a-aef4-56c7ef588c34 | 5 | public static MultipleChoiceQuestion getMultipleChoiceQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) {
int quizID = quiz.quizID;
int position = pos;
Object question = null;
Object answer = null;
double score = 10;
ArrayList<String> questionList = new ArrayList<String>();
for (int i = 0; i < root... |
455ee554-7ff9-49af-89d4-a7754d2bba3b | 4 | public Game(World world, BrainParser b1, BrainParser b2){
// ArrayList<Instruction> brain1 = new BrainParser("src/cleverbrain3.brain").parseBrain();
// ArrayList<Instruction> brain2 = new BrainParser("src/cleverbrain4.brain").parseBrain();
ArrayList<Instruction> brain1 = b1.parseBrain();
ArrayList<Instruction>... |
e425f7b5-2aaf-46f2-87e2-7863f572f33a | 6 | private ArrayList<Action> findPathsFromActionMap(
int goalRowID, int goalColID, int goalDrcID) {
//int startRowID,int startColID,int startDrcID) {
ArrayList<Action> actions = new ArrayList<>();
//Find the action min distance
int rowID = goalRowID;
int colID = goalColID;
int drcID = goalDrcID;
wh... |
bbc0baee-54bd-48e9-8ae0-a4b4d90337fd | 9 | private ResourceManager()
{
m_textTileMap = new HashMap<Integer, TileResource>();
m_objectsMap = new HashMap<Integer, MovableResource>();
try {
InputStream is = getClass().getResourceAsStream(RESOURCES_FILE);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder d... |
180991fb-c779-4644-93cb-28e7f1fef88d | 5 | public List<Vak> getVakkenVanStudent(long studentId) {
List<Vak> vakken = new ArrayList<Vak>();
List<Long> klasIds = new ArrayList<Long>();
List<Long> vakIds = new ArrayList<Long>();
try {
PreparedStatement prepareStatement = manager
.prepareStatement("SELECT klas_id FROM leerling_klas WHERE leerling_id... |
6adaccdf-2d99-46d6-8a77-8f3b3a054ee2 | 7 | void updateCacheView() {
TlvCacheInstance cache = cacheModel.getCacheInstance();
TlvCacheState cacheState = (cache == null ? null : cache.getState());
buttonInitCache.setEnabled(cacheState == null || cacheState == TlvCacheState.CREATED || cacheState == TlvCacheState.STOPPED);
buttonStartCache.setEnable... |
cad29a60-461f-443d-a07d-cb364b3f5bcf | 6 | private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
... |
a76631da-813b-4ef1-b9cd-d3e5a58857a0 | 2 | public void setDimension(Dimension dim, int size) {
if (dim.getSize() == size) return;
dim.setSize(size);
Set param_set = getParamsForDim(dim);
for (Iterator i = param_set.iterator(); i.hasNext();) {
Parameter param = (Parameter)(i.next());
param.resize();
... |
495bddba-3ec2-4b1d-97a6-89b1cbafa2f5 | 1 | public static void toggleEditableAndClearForSingleNode(Node node, CompoundUndoable undoable) {
toggleEditableForSingleNode(node, undoable);
for (int i = 0, limit = node.numOfChildren(); i < limit; i++) {
clearEditableForSingleNode(node.getChild(i), undoable);
}
} |
d979460a-450c-4178-aecc-d3ff63433d2e | 1 | public static void setPageRanges(PrintRequestAttributeSet set, PageRanges ranges) {
if (ranges != null) {
set.add(ranges);
} else {
set.remove(PageRanges.class);
}
} |
74f6822f-efdb-43cf-a1ae-1dab68b15a0f | 6 | public void mousePressed(MouseEvent e) {
if (image !=null && tileset) {
if (e.getX()>=0 && e.getX() <=image.getWidth() && e.getY() >= 0 && e.getY() <= image.getHeight()) {
x0=e.getX()/(8*zoom);
y0=e.getY()/(8*zoom);
}
}
} |
5fe618dc-a4b6-4646-8fe3-44271416de63 | 4 | public void render(Graphics g) {
if (active) {
if (img != null) {
boolean hover = checkMouse(InputHandler.getInstance().getMouseHoverPoint());
if (hover)
g.drawImage(img, x, y, width, height, Color.darkGray, null);
else
g.drawImage(img, x, y, width, height, null);
}
if (text != null) ... |
5e660a48-d298-4675-9e9e-6f4aebe3ffd6 | 3 | public Path getBestPath()
{
if(Ways.isEmpty())
{
return(new Path());
}
float length = Ways.elementAt(0).getDistance();
int p = 0;
//Besten Pfad ausrechnen
for(int i=0; i<Ways.size(); i++)
{
if(Ways.elementAt(i).getDistance() < length)
{
p = i;
}
}
return(Ways.elementAt(p));
} |
a653948a-21e3-4435-a662-e484629ca57e | 3 | public static void main(String args[]) throws Exception{
NavigableSet nav = new TreeSet<>();
nav.add("A");
nav.add("B");
nav.add("C");
nav.add("D");
nav.add("E");
// Testing flag inclusive and exclusive
SortedSet tail = (NavigableSet)nav.tailSet("A");
NavigableSet head = nav.headSet("E",tru... |
82bedeb4-a3ec-4c4a-aa53-ccf23471f0ef | 5 | @Override
public void handleModelChangeEvent(ModelChangeEvent e){
displayMessage(e.getMessage());
drawList = e.getDrawable();
for(Drawable2D drawable : drawList) {
if(drawable.getClass().equals(Player2D.class)) {
player = (Player2D)drawable;
}
if(drawable.getClass().equals(Room2D.class)) {
mapAr... |
c252fa0c-c0ee-439a-8d37-8e93db4e6b5b | 8 | @Override
public void cycler() {
// Choices
String[] speedModes = { "Easy", "Normal", "Hard" };
// Input System
String speedSelect = (String) JOptionPane.showInputDialog(null,
"Choose Difficulty", "RunBitMan 2", JOptionPane.PLAIN_MESSAGE,
null, speedModes, "Easy");
long speed = 100;
if ((speedSe... |
07be0171-41ab-435c-b930-d4acf4b81af3 | 2 | @RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDa... |
0df3c30f-d12c-4004-aeb0-8ab81bd6f33a | 9 | public void initialisationFinaleProvince(){
for(Province p : this.hashProvince){
switch(p.getNom()){
case "Chugoku" :
case "Kanto" : p.setTroupe(new Troupes("Samouraï", "Vert"));
break;
case "Chubu" :
case "Kansai"... |
bf5b35a1-e2c5-4d62-897c-1f68ee3eee77 | 1 | public final void unlinkSub() {
if (previousNode == null) {
} else {
previousNode.nextNode = nextNode;
nextNode.previousNode = previousNode;
nextNode = null;
previousNode = null;
}
} |
b63edff5-0704-4eaa-ac1b-a8d55139ba92 | 8 | private void expand1(byte[] src, byte[] dst) {
for(int i=1,n=dst.length ; i<n ; i+=8) {
int val = src[1 + (i >> 3)] & 255;
switch(n-i) {
default: dst[i+7] = (byte)((val ) & 1);
case 7: dst[i+6] = (byte)((val >> 1) & 1);
case 6: dst[i+... |
1d4f414f-6e10-4894-86d1-f126cabc5a42 | 3 | public boolean adisyonEkle(String masaAdi,String urunAdi,int miktar){
Siparis siparis = new Siparis(new Urun().urunBul(urunAdi), miktar);
Bilgisayar b = masaBul(masaAdi);
if(b!=null){
if(mutlakkafe.MutlakKafe.mainCont.getUrunCont().urunSat(siparis.getUrun().getUrunID(), mikta... |
d009aff9-6469-4387-911f-8331a42ed426 | 7 | @Override
public void initializeNorm()
{
checkingNorms();
for ( Action action : getAllActions().values() )
{
if ( action.getNormType() != null ) // Only action linked with deontic concept will goona be setted
{
if ( action.getNormType() == NormType.OBLIGATION )
{
if ( getPlayer().containAct... |
fbedf05b-9ad6-4f3a-8a57-14fc0c404bff | 3 | public void start() {
if(!fTimer.isRunning()) {
if(fAnimationTarget == null) {
throw new IllegalStateException("Animation target is not set!");
}
fAnimationStartTime = System.nanoTime() / 1000000;
final Runnable r = new Runnable() {
public void run() {
fAnimationTarget.begin(AnimationTimer.th... |
16794f5b-9486-4147-8abe-76f3b4430a0b | 7 | public void runScript(String configFileName)
{
int lineNum = 0;
try {
BufferedReader in = new BufferedReader(new FileReader(configFileName));
String line;
while ((line = in.readLine())!=null) {
lineNum++;
if (!line.startsWith("#")) {
String command = null;
List args = new ArrayLis... |
55f592bf-3606-449b-89a0-48ccf043c628 | 4 | public static byte[] compressRow(byte[] b) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte active = b[0];
byte same = (byte) -127;
for (int i = 1; i < b.length; i++) {
if (b[i] == active && same < 127) same += 1;
else {
baos.write(new byte[] { same, active });
same... |
5e0f5a9e-1b18-4a11-8645-1dfdb0c05e16 | 7 | public boolean checkWin() {
boolean gameWon = false;
boolean gameWonBackDiagonal = false;
boolean gameWonVertical = false;
boolean gameWonForwardDiagonal = false;
boolean gameWonHorizontal = false;
for (int j=0; j<WIDTH ; j++) {
for (int i=0; i<HEIGHT ; i++) {
if (m_Pieces[j][i].getPieceColour() != E... |
cebdbd44-d91a-46a6-98c5-5505f334002a | 7 | public Object displayCreateActivityPrompt() throws IOException{
Calendar cal = Calendar.getInstance();
Date date = cal.getTime(); //set to today
Date duration = null;
String title = "";
String note = "";
Activity activity = new Activity(userName);
System.out.println("Record an activity"); //initial pro... |
4fadb04a-7087-443a-85c6-7639febfba62 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
fbb10cfd-cd0e-4e6b-8cca-b6175b75ed7e | 9 | public static char boardIntToString(boolean[] value) {
// System.out.print("boardToString: " + Integer.toBinaryString(value) +
// " ");
char ret = 'r';
if (Conversions.isWall(value)) {
ret = Constants.S_WALL;
} else if (Conversions.isPlayer(value) && Conversions.isGoal(value)) {
ret = Constants.S_PLAYE... |
d930683e-3cca-4917-92ca-5325035aa764 | 0 | public void setSector(String sector) {
addressCompany.setSector(sector);
} |
71faa99b-f53c-4180-bb58-7b24617e649a | 7 | protected synchronized void executeQuieries() {
if (!m_queries.isEmpty())
{
String query = null;
Statement statement = null;
final Connection connection = getConnection();
try {
if (connection == null) {
Utilities.outputError("Could not connect to database.");
return;
}
... |
b222b984-c69c-4dea-b053-ee0e0361219f | 7 | private DefaultTreeModel parseTree(String string, Grammar grammar,
LLParseTable table, List nodes) {
int p = 0;
string = string + "$";
Stack stack = new Stack();
MutableTreeNode root = new DefaultMutableTreeNode(grammar
.getStartVariable());
stack.push(root);
nodes.add(root);
DefaultTreeModel tree ... |
89cfeb5b-e7fc-4908-aab5-a1dc4d331720 | 6 | public int correSimulacion(Estrategia estr, Datos dato, String id,
int max_time) {
Nodo nodo = null;
time = 0;
if (true) {
estado = new Estado(estr);
for (Sensor x : estr.getSensores())
x.setEstado(estado);
estr.setEstado(estado);
estado.initEstado();
addAleatOponents(MAX_ENEMIGOS);
}
... |
bc5bdcaf-11f7-4883-ab63-f3794518268f | 5 | private Node<U, T> buildSubtree(List<T> intervalList, int low, int high) {
U point = intervalList.get((low + high) >>> 1).getLow();
Node<U, T> result = new Node<U, T>(point);
int lowPointer = low;
int highPointer = high;
for (int j = low; j < highPointer; j++) {
T next = intervalList.get(j);
... |
5e20bb97-c7d5-454b-a194-78b1ff0ff319 | 0 | @Override
public void setMaximum(int i) {bar.setMaximum(i);} |
90802731-082b-4ead-8cb4-a6ed621f4b5e | 7 | private static String getText(final List<List<Symbol>> board) {
List<WinnerChecker> winnerCheckers = Arrays.asList(new HorizontalChecker(), new VerticalChecker(new Column()),
new VerticalChecker(new DiagonalIncreasing()),
new VerticalChecker(new DiagonalDecreasing()));
/... |
9a929c1a-37ef-4ef6-aa79-3093782f1458 | 3 | public boolean equalsInContent(Deck d) {
if (this.cardArray.length != d.cardArray.length)
return false;
for (int i = 0; i < cardArray.length; i++) {
if (d.binarySearch(cardArray[i]) == -1) {
return false;
}
}
return tr... |
16fa02fb-fa0e-4509-a299-4c7b0be6e8a8 | 0 | public James()
{
super("James", 6500, 250, 50, 80, as);
as.setSkill(0, "Work Hard", 100, 20, "James works very hard in class.");
as.setSkill(1, "Wise", 200, 45, "James is exceptionally wise.");
as.setSkill(2, "Program", 500, 100, "James creates a deadly program.");
as.setSkill(3, "High Mark", 4500, 180, "Jam... |
53971e11-56f6-4a72-b79d-cef9e47d6196 | 9 | private int jjMoveStringLiteralDfa7_1(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return 7;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return 7;
}
switch(curChar)
{
case 69:
case 101:
return jjMoveStringLiteralDfa8_1(active0... |
dda51767-89a8-4c06-906d-044a5e981319 | 0 | public GUI() {
setTitle("Calculator");
setSize(WIDTH, HEIGHT);
setLocationRelativeTo(null); // Center the GUI
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
ImageIcon icon = new ImageIcon(this.getClass().getResource("/icon.png"));
this.setIconImage... |
540c93a2-57f3-474f-be4b-281fce265820 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Funcao)) {
return false;
}
Funcao other = (Funcao) object;
if ((this.id == null && other.id != null) || (this.i... |
ae08568c-12bb-4b13-8de6-cc8fa687165f | 4 | @Override
public boolean hesapBilgiGuncelle(String kullaniciAdi, Kisi kisi) {
int sonuc = JOptionPane.showConfirmDialog(null, kullaniciAdi +
" isimli müşteri bilgilerini değiştirmek istediğinize emin misiniz?", "Müşteri Güncelle",
JOptionPane.YES_NO_OPTION, JOptionPane.QUEST... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.