method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0ccf1099-92d9-47c4-9003-5520f5ea0d99 | 6 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
{
if (gc.getInput().isKeyDown((Input.KEY_ENTER)) && fenetre==null)
{
try {
fenetre = new Fenetre(GameOverState.getScore());
} catch (IOException e) {e.printStackTrace();}
catch ... |
1b9af103-e59b-4a5a-b249-c989644f77b9 | 7 | public static boolean cppNativePointerTypeP(String nativetype) {
{ int length = nativetype.length();
{ int i = Stella.NULL_INTEGER;
int iter000 = 1;
int upperBound000 = length;
boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;
loop000 : for (;unboundedP000 ||
... |
d04fc452-275c-4e04-8999-6cdd0ebe0b48 | 9 | public synchronized void movemouse (int i, int j)
{ if (Pos.haschildren()) return;
if (P.color(i,j)!=0) return;
if (captured==1 && capturei==i && capturej==j &&
GF.getParameter("preventko",true)) return;
if (Pos.isMain() && CGF.wantsmove())
{ if (CGF.moveset(i,j))
{ sendi=i; sendj=j;
update(i,j); cop... |
b4d38e47-8a08-42e9-92d8-17e2ac4d8bb2 | 5 | public static Graph ComponentesFortementeConexas(Graph grafo) {
DepthFirstSearch dfs = new DepthFirstSearch(grafo);
/**
* Calcula a lista de termino
*/
dfs.doListaTermino(true);
dfs.run();
ArrayList<Integer> fechamentoGrafo = dfs.getListaTermino();
//Calcula o DFS para o transposto do Grafo origi... |
f1264c4d-a13e-4690-980e-53d96c6175ee | 7 | public void setStatus(String status) {
this.status = status;
System.out.println(status);
if (status.equals(Status.PENDING.toString())) {
this.status_numeric = 1;
} else if (status.equals(Status.UNDER_PREPARATION.toString())) {
this.status_numeric = 2;
} el... |
b1ebb5e0-02fd-43c9-be50-b3242cb222ff | 7 | @Override
public void sequence(String id, String sequence, String quality) {
boolean ok = true;
if (qdecoder != null) {
int qual[] = null;
try {
qual = qdecoder.decodeQuality(quality);
} catch (QualityFormatException e1) {
String error = String.format(
"Quality encoding is not correct: %s",... |
84037bdd-201d-4dca-8b4a-620a9cb8ff8b | 8 | public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
Component c= super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
TreeModel model= tree.getModel();
if (model instanceof ... |
307ccdcb-097f-4e40-87c2-d05c5a39d61a | 5 | @Override
public List<Event> searchEventByPerformer(Performer p) {
final List<Event> ret = new ArrayList<Event>();
final String pID = p.getId();
final HashMap<String, String> params = this.createDefaultHashMap();
params.put("location", pID);
final String url = this.conn.prepareURL("performers/even... |
0126aed5-19d7-4e1b-b74e-2e7b258e56fe | 8 | protected String replaceAllWords(String S, String strWhat, String strWith)
{
if(separators == null || S == null || strWhat.equals(strWith))
return S;
int pos;
int begin = 0;
String returnS = S;
String before;
String after;
while((pos = S.indexOf(strWhat, begin)) != -1)
{
before =... |
df262448-cb66-46ed-bed3-7905e8b7110e | 7 | public void rigidify() {
RadialBondCollection rbc = model.getBonds();
RadialBond rb;
synchronized (rbc.getSynchronizationLock()) {
for (Iterator it = rbc.iterator(); it.hasNext();) {
rb = (RadialBond) it.next();
if (contains(rb.getAtom1()) && contains(rb.getAtom2())) {
rb.setBondStrength(RIGID_BON... |
bc8d580f-ecc4-40d8-bb15-e00df67657a2 | 0 | public void setName(String name) {
this.name = name;
} |
5bc0a123-355c-498d-aa6f-344e98f2c42f | 7 | @Override
public void run() {
stdIn = new BufferedReader(new InputStreamReader(System.in));
String userInput;
try {
while (exit == false && ((userInput = stdIn.readLine()) != null)) {
processInput(userInput);
}
// stutdown when exit
if (exit == true) {
stdIn.close();
// propper sh... |
32bf392f-6f94-4edb-9fb8-e1a4a0b2cc88 | 6 | @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Fish) {
Player player = (Player) ((Fish) event.getDamager()).getShooter();
WorldConfiguration cfg = plugin.get... |
8e732e94-8338-46bc-a6f0-d63e578b1ec1 | 7 | private static void addToken(TokenInfo info) {
if (!lineComment && !multiLineComment) {
if (info.getToken() == Tokens.LINE_COMMENT) {
lineComment = true;
return;
} else if (info.getToken() == Tokens.MULTILINE_COMMENT_OPEN) {
multiLineComment = true;
return;
}
tokenList.addToken(in... |
2f42e573-a8e3-4959-a7ad-11c9d2e20c31 | 0 | public static Rectangle2D getScreen()
{
return (Rectangle2D) screen.clone();
} |
e4786b95-9561-4736-8538-2c98489df825 | 6 | public OP parse(Class resultType) throws CompilationException {
try {
expression();
err_col=ct_column-1; // this should be now set to <EOF>
// remove TSB at return if present
if (((OP)paramOPs.peek()).resID==10)
paramOPs.push(new OPunary(paramOPs,11,null,false));
// set resul... |
2a9ffd88-34f3-4072-807b-5f1e71c9e37a | 9 | public static void main(String[] args) {
if(args.length == 3) {
int hours = -1, start = -1, end = -1;
try {
hours = Integer.parseInt(args[0]);
start = Integer.parseInt(args[1]);
end = Integer.parseInt(args[2]);
} catch(Throwable t) {
System.out.println("One of the arguments was not a number")... |
4b1c4d0e-fba6-48cc-8837-fb85ff838dfc | 4 | public void mover(){
//int lado = new Random().nextInt(4);
//posicion x,y del label
int x = this.refLabel.getLocation().x;
int y = this.refLabel.getLocation().y;
ImageIcon iconLogo = new ImageIcon(IMG.getImage(this.imagen_mov));
this.refLabel.setIcon(ico... |
51ae6901-ffa9-4fd5-9fc1-8fbf168d5534 | 7 | public static void main(String[] args) {
NetworkEvent networkEvent;
//inicia os nós
init();
//enquanto a lista de eventos não está vazia permanece no loop
while (!NetworkEventList.isEmpty()){
networkEvent = NetworkEventList.get(NetworkEvent... |
af34a44c-e988-41cc-8af6-b1924cabe8a6 | 3 | @Override
public void onEnable() {
try {
Config.initialise(getConfig(), getDataFolder());
Config.load();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
e.printStackTrace();
}
registerCommands... |
34f9b981-dc43-4538-aaae-0dc5f32251b3 | 5 | public void readFromStream(InputStream is, boolean clear) throws IOException {
if(clear) {
ObjectList.clear();
ObjectNames.clear();
ObjectType.clear();
}
DataInputStream dis = new DataInputStream(is);
String name;
Types type;
String s;
FileWriter fw;
while(dis.readBoolean()) {
name = dis.... |
a6028212-306f-46cd-9d0d-28f295e57f3b | 6 | private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
try {
if (!valid()) {
return;
}
System.out.println("\"" + comboGemeentes.getSelectedItem() + "\"");
model.setFirm(txtFirma.getText());
model.setSortKey... |
49ced044-57c3-4e23-ae5d-9eb7fd47c711 | 0 | public Object count() {
return results.size();
} |
4297b3db-ea0f-4933-8794-4a8a8f1b4d7a | 3 | public Type[] indexedParamTypes() {
if (paramTypes == null) {
return null;
}
final ArrayList p = new ArrayList(paramTypes.length * 2);
// Count longs and doubles as 2.
for (int i = 0; i < paramTypes.length; i++) {
p.add(paramTypes[i]);
if (paramTypes[i].isWide()) {
p.add(null);
}
}
fina... |
502fa5f2-f3ea-4693-b856-b4609c9e94c5 | 0 | protected String foo2() {
return s + " is a string";
} |
59d39090-af38-45bc-a736-288f076b50d6 | 1 | public void scrollContentToX(int x) {
if (x != mHSB.getValue()) {
mHSB.setValue(x);
}
} |
02f1222b-669f-43f8-873b-f0480bd452b8 | 7 | private int[] merge(int[] leftArray, int[] rightArray) {
int mergedLength = leftArray.length + rightArray.length;
int[] mergedArray = new int[mergedLength];
int leftIndex = 0;
int rightIndex = 0;
while (leftIndex + rightIndex < mergedLength) {
// There are still items to be merged
if (leftIndex < le... |
71ddf0ab-c8d9-4321-b45f-1c964971658b | 2 | public Currency get(String code){
for (Currency currency: instance)
if (code.equalsIgnoreCase(currency.getCode()))
return currency;
return null;
} |
c06225d7-c4b3-490b-b852-e62491f160a6 | 4 | public static void Upperauthor(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmn... |
b1c2d8a3-21c0-4aef-b831-a4832ae15140 | 3 | private void passOn(){
//loop that finds all the enemy players that are less than 10 away from this player
ArrayList<PlayerData> closestEnemies = new ArrayList();
for(PlayerData e : visibleOtherPlayers){
if(e.getDistanceTo() < 10) closestEnemies.add(e);
}
if(closestE... |
f946854f-08ec-4fcb-9cd1-fd93e1928e87 | 5 | private void boutonForgeDesNainsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boutonForgeDesNainsMouseClicked
// TODO add your handling code here:
if (partie.getFdn().isActif()) {
if (!partie.getDieuActuel().isaJouerEnForgeDesNains()
|| ((partie.getDieuAc... |
8e0e5e2d-d771-4b42-b71a-9f14fc960250 | 1 | @Override
public Object findByName(String theName) throws Exception {
try {
session = HibernateUtil.getSessionFactory().openSession();
//Query q = session.getNamedQuery("name.igual");
Query q = session.getNamedQuery(getNamedQueryToFindByName());
q.setString("n... |
bdbb6a52-17f3-4e17-af22-ac3cf8200e1e | 4 | public boolean isPressed(int kc) {
if (KeyEvent.VK_A == (char)kc) {
theMap.getCharacter().setDirection(-1);
return true;
} else if (KeyEvent.VK_D == (char)kc) {
theMap.getCharacter().setDirection(1);
return true;
} else if (KeyEvent.VK_ESCAPE == (char)kc) {
System.exit(0);
return true;
} else ... |
20a6dfdf-2d90-44e3-8d48-d4a703714ef0 | 5 | @Override
public boolean equals(Object obj) {
if (obj instanceof Schedule) {
Schedule objSchedule = ((Schedule)obj);
if (objSchedule.allocationMapping.size() != this.allocationMapping.size()) {
return false;
}
for (Entry<Occurrence... |
5848fb5a-2d17-47f2-ad6a-b924bf140b26 | 2 | private void paintTree()
{
addAnswerToList(myParser.getAnswer().getDerivation());
ParseNode answer=myParser.getAnswer();
treePanel.setAnswer(answer);
treePanel.repaint();
if (answer.getProductions().length>0)
statusDisplay.setText("Derived current Strings using "+answer.getProductions()[0]+" production")... |
d0379b0e-d38a-4c6e-ba87-19da357164bc | 1 | public boolean onTyhja() {
return eiSisallaLaskutoimituksia() && seuraavaArvollinen == null;
} |
2185a4d5-04e8-4ad8-b422-dd564db6445d | 2 | public LinkedListNodeIterator<AnyType> copy3()
{
LinkedListNodeIterator<AnyType> twin = new LinkedListNodeIterator<AnyType>();
Node<AnyType> tmp = head;
if(head==null) return null;
twin.head = new Node<AnyType>(head.data, null);
Node<AnyType> tmpTwin = twin.head;
while(tmp.next !=... |
f2eb2686-cda1-465d-8c82-78ea47e8448f | 3 | private InputStream getcached(String nm) throws IOException {
/*
* if(ResCache.global == null) throw(new
* FileNotFoundException("No resource cache installed"));
* return(ResCache.global.fetch("mm/" + nm));
*/
if (mappingSession > 0) {
String fileName;
if (gridsHashes.containsKey(nm)) {
... |
ee2d1773-e2b7-433c-b3e0-9c7065533383 | 6 | public Level(int width, int height) {
w = width;
h = height;
b = new Block[w * h];
int c = 0;
Random r = new Random();
int cupLoc = r.nextInt(w * h);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
Block bb = null;
... |
e5b93b4d-9ea2-46ca-9b08-262914f2025b | 4 | public String Create_Sentence(boolean orFirst, ResultBean resultBean){
Util util = new Util();
Reader reader = new Reader();
String sps = reader.propReader(Const.EXPORT_PARTITION) + Const.str_null; // Const.TAB
String bar = reader.propReader(Const.EXPORT_PARTITION_BAR);
String str = null;
StringBuffer ... |
fee04aff-74aa-43b2-b1ca-4d4f51d79dca | 3 | public Configuration loadEmbeddedConfig(final String resource) {
final YamlConfiguration config = new YamlConfiguration();
final InputStream defaults = this.getResource(resource);
if (defaults == null) return config;
final InputStreamReader reader = new InputStreamReader(defaults, Custo... |
26699f16-5368-4565-aadc-4e841066aa53 | 7 | public void render ()
{
if (bi != null && !updating) {
if (textureID != -1) glDeleteTextures(textureID);
textureID = Utilities.loadTexture(bi);
bi = null;
}
if (textureID == -1 || !isVisible()) return;
glEnable(GL_TEXTURE_2D);
glEnable(GL_... |
703d7279-33d8-42cb-bbee-9f2f5d72266e | 7 | private void out() {
if (BEGIN_CLAUSES.contains(lcToken) || END_CLAUSES.contains(lcToken) || LOGICAL.contains(lcToken)
|| QUANTIFIERS.contains(lcToken) || DML.contains(lcToken) || MISC.contains(lcToken)
|| FUNCTIONS.contains(lcToken)) {
token = token.toUpperCase();
}
result.append(token);
} |
c7e2255a-557c-4e9a-a79b-8d51d105a37a | 6 | private static void
writeTable(PdfWriter __writer)
throws BadElementException, DocumentException, IOException
{
PdfContentByte canvas = __writer.getDirectContent();
canvas.saveState();
canvas.setLineWidth(0.1f);
float origin_x = 50f;
float origin_y = 60... |
3c72885e-cf4a-42ef-a0dd-14c25cce8555 | 1 | public void deleteFiles(Collection<String> filenames) throws IOException {
connect();
for (String filename : filenames) {
client.deleteFile(filename);
}
disconnect();
} |
66107394-abb3-4ec4-aa43-c130ebc09138 | 8 | public String[] parseCounterExampleFromTrace(PreferenceMetaData pmd, boolean firstStateOnly) throws FileNotFoundException, IOException {
Set<String> variablesTrueInOutcome = new HashSet<String>();
BufferedReader reader = new BufferedReader (new FileReader(pmd.getCounterExampleFile()));
try{
String nextLin... |
0a042b6a-5944-4a7d-8d74-5a0fc430c00f | 2 | public static Matrix random(int M, int N) {
Matrix A = new Matrix(M, N);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
A.data[i][j] = Math.random();
return A;
} |
0510d1f6-9882-48de-b52d-e8067d316a5e | 2 | private static int runStatementGetID(String statement)
{
try
{
getConnection();
Statement st = con.createStatement();
int numofkey = st.executeUpdate(statement, Statement.RETURN_GENERATED_KEYS);
ResultSet keys = st.getGeneratedKeys();
int k... |
c93dd3bd-48a8-4fcc-9d2f-276c998b292b | 2 | @Override
public void paintComponent(Graphics g)
{
pixelsW = BigDecimal.valueOf(getWidth());
pixelsH = BigDecimal.valueOf(getHeight());
horizontalIncrement = right.subtract(left).divide(pixelsW,mc);
verticalIncrement = bottom.subtract(top).divide(pixelsH,mc);
for(int x = ... |
46084e6f-5081-4c9d-b03c-adba023d6a1f | 3 | private MultimapEdge<V> addEdge(Integer key) {
Entry<Integer, MultimapEdge<V>> floorKey = edges.floorEntry(key);
if(floorKey == null || floorKey.getKey().compareTo(key) != 0) {
// going to add new edge, but with what values?
MultimapEdge<V> list;
if (floorKey != null)... |
8bdf14a9-e9a6-4a54-a84c-7d585a7dd1e1 | 2 | public static double aexsec(double a){
if(a<0.0D && a>-2.0D) throw new IllegalArgumentException("aexsec argument (" + a + ") must be >= 0.0 and <= -2");
return Math.asin(1.0D/(1.0D + a));
} |
5d6df21b-72fa-410f-9f3f-1681c6c2e337 | 8 | private void findVector(prQuadNode curQNode, Vector<T> elem, double xLo, double xHi, double yLo, double yHi, double xMin, double xMax, double yMin, double yMax) {
//Case 1: curQNode is null
if(curQNode == null)
return;
//Case 2: curQNode is a qInternal
else if(curQNode.getClass().getName().equals("prQuadtree... |
6f324d63-40e0-4cd9-a544-edc0a2006efd | 8 | public String toString() {
boolean i2c = false;
boolean spi = false;
StringBuffer sb = new StringBuffer();
sb.append(getName());
sb.append(":Handle[");
sb.append(getHandle());
sb.append("],Id[");
sb.append(getId());
sb.append("],Rev[");
sb... |
53b61494-06f7-466e-88ba-abb109bf2403 | 0 | public Screen(Game game) {
this.game = game;
this.pixels = new int[game.getScaledWidth() * game.getScaledHeight()];
} |
c67607cf-a045-447d-b70b-66e52a1cc966 | 1 | public Image loadSplashImage() {
MediaTracker tracker = new MediaTracker(this);
Image result;
result = tk.getImage(imgName);
tracker.addImage(result, 0);
try {
tracker.waitForAll();
} catch (Exception e) {
e.printStackTrace();
}
imgWidth = result.getWidth(this);
imgHeight = result.getHeight(this... |
f105afde-43b7-499a-a105-2db8782c6633 | 5 | public Hr(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "align":
align = Align.parse(this, v);
break;
case "noshade":
noshade = Noshade.parse(this, v);
bre... |
2da84b53-ba50-424f-ace7-0f7906a50435 | 5 | public float priorityFor(Actor actor) {
if (actor == subject) return 0 ;
float priority = actor.mind.greedFor(rewardAmount(actor)) * ROUTINE ;
priority -= Plan.dangerPenalty(subject, actor) ;
priority -= duration() * 0.5f / World.STANDARD_DAY_LENGTH ;
if (subject instanceof Actor) {
prior... |
867d12dc-e78f-4725-9794-a0d0d3e1dabd | 8 | @Override
protected void updateTestGeneratorByNewTest(final Test acceptedTest) {
possibleTestsList.remove(acceptedTest);
final List<Callable<Object>> tasks = new LinkedList<Callable<Object>>();
for (int i = 0; i < possibleTestsList.size(); i += MIN_TESTS_COUNT_TO_EXECUTE) {
fi... |
b5f4f458-37cc-4231-8edd-48a5dce3ad20 | 4 | private void doForm(PDFObject obj) throws IOException {
// check to see if we've already parsed this sucker
PDFPage formCmds = (PDFPage) obj.getCache();
if (formCmds == null) {
// rats. parse it.
AffineTransform at;
Rectangle2D bbox;
PDFObject mat... |
53383b9b-6fea-4e5a-ae5a-0d62713217f7 | 7 | public SwitchInfo(String shortName, String longName, String description, boolean required, boolean flag, String defaultValue, Class<?> type) {
if (StringUtils.isBlank(shortName) && StringUtils.isBlank(longName)) {
throw new IllegalArgumentException("both short name and long name are null or empty");... |
fcaa89e2-5118-47c4-b33a-e028035d6501 | 0 | public static void set(SimulatedCoffeeMaker coffeeMaker) {
globalCoffeeMaker = coffeeMaker;
} |
18fe52d0-d307-4c30-8ef8-093a4bb46c7f | 8 | public static int pushAdjacent(PriorityQueue<Pair<Integer, Integer>> myQueue, int[][] canTravel, Pair<Integer, Integer> curr, Map<String, String> myMap, AstarComparator comparator){
int currX = curr.getFirst();
int currY = curr.getSecond();
if(currX+1<canTravel.length && canTravel[currX+1][currY]==... |
ccd5306a-7c74-41f7-bf14-6c8f33641231 | 7 | private static ArrayList<Configuration> sautRecursif(Configuration conf, byte[] triplet, byte typeSauteFirst, boolean noirEnPlayer){
ArrayList<Configuration> listeConf = new ArrayList<Configuration>();
byte caseDebut = triplet[0];
byte typeSaute = triplet[1];
byte caseFin = triplet[2];
byte newTurttle... |
6d049125-3a6a-4193-9320-e1bd0f957f8d | 9 | public static List<String> synthesizeInsertIntoQueries(DeviceObservationData observationData) {
List<String> queries = new ArrayList<String>();
String devicename = observationData.getDeviceName();
String uuid = observationData.getSensorUUID();
devicename = devicename.replaceAll("-", "");
StringBuilder quer... |
3b9ccedc-3030-4ca6-88a9-622c919eeb0e | 4 | private void validateLength(JsonNode node, List<ErrorMessage> results) {
if (minLength > 0) {
String value = type.getValue(node).toString();
if (value.length() < minLength) {
results.add(new ErrorMessage("", "Value '" + node.textValue() + "' must be greater or equal to " ... |
2679c970-f501-4534-b14d-b1bfb7d11d5d | 7 | public int AddFiliere(String NouvelleFiliere){
int retour;
if (NouvelleFiliere.isEmpty()){
return -2;
}
if (NouvelleFiliere.startsWith(" ")){
return -4;
}
if (NouvelleFiliere.length()>32){
return -5;
}
... |
d2bfa0f3-8380-46f2-9a02-3ce1334c0e73 | 9 | protected boolean isSubTypeOf(final Value value, final Value expected) {
Type expectedType = ((BasicValue) expected).getType();
Type type = ((BasicValue) value).getType();
switch (expectedType.getSort()) {
case Type.INT:
case Type.FLOAT:
case Type.LONG:
... |
dd4e0194-97ea-4f62-9ce2-1a190f9db640 | 9 | @Test
public void test() throws InterruptedException {
Thread.sleep(SLEEPMS);
// Step 1. Confirm you can instantiate multiple video players within a single slide.
frame.setLayout(null);
videoPlayer.setLocation(video.getX_coord(), video.getY_coord());
videoPlayer2.setLocation... |
366b3e06-9d2f-4c81-8178-d8535861c795 | 5 | public Bundle minus(Bundle goal) {
Bundle diff = new Bundle();
for(ResourcePile have:contents){
ResourcePile copy = new ResourcePile(have);
for(ResourcePile used:goal){
if (copy.type == used.type){
copy.amount -= used.amount;
if (copy.amount < 0) copy.amount = 0D;
break;
}
}
if (c... |
9e10afd1-4164-4757-8027-622d18498542 | 0 | public String getHoraRecogida() {
return horaRecogida;
} |
5851a932-3fd6-49b1-8a85-3bb4e4d07b57 | 0 | public int f() {
return 1;
} |
7450aa11-2a6b-403a-b1d0-97d0c648c4ec | 9 | public static Location gridLocation(int x, int y){
assert ((x < 4) && (y < 4));
int xdim = 0;
switch (x){
case 0: xdim = cGRID_POINT1;
break;
case 1: xdim = cGRID_POINT3;
break;
case 2: xdim = cGRID_POINT5;
break;
case 3: xdim = cGRID_POINT7;
break;
}
int ydim = 0;
switch (y){... |
a7691acc-775a-4e87-95a2-dd5545f30b4d | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConnectionConfiguration that = (ConnectionConfiguration) o;
if (connectionName != null ? !connectionName.equals(that.connectionName) : that.connectionN... |
d53be20d-90ef-4454-8af5-d8769ff3a309 | 7 | public void mouseReleased(MouseEvent evt) {
//Fill in pixels in between and connect the first to the last
int N = selectionBorder.size();
if (N == 0 || (state != SELECTING && state != DRAGGING))
return;
if (state == SELECTING) {
for (int n = 0; n < N; n++) {
int startx = selectionBorder.get(n).x... |
9856d4e1-856d-456f-8b9c-acf959a13eaa | 7 | * @param decrement
* @return Stella_Object
*/
public static Stella_Object _(Stella_Object place, Cons decrement) {
{ Stella_Object decr = decrement.value;
if (!(Stella_Object.symbolP(place) ||
Stella_Object.consP(place))) {
if (place == null) {
{ Object old$PrintreadablyP$... |
3a9708ca-0c74-488a-8c49-076416099468 | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (this.getClass() != obj.getClass()) return false;
final Region other = (Region) obj;
if (this.name == null) {
if (other.name != null) return false;
... |
0a728d04-b374-45a7-bb67-7c5e40f22451 | 3 | public AbstractExporter(Invoker<T> invoker) {
if (invoker == null)
throw new IllegalStateException("service invoker == null");
if (invoker.getInterface() == null)
throw new IllegalStateException("service type == null");
if (invoker.getTpURL() == null)
throw new IllegalStateException("service url == null"... |
9f3d839d-46b2-412d-98af-9bd17db3d1f2 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < ... |
d153bfcb-2341-48fd-8697-5d326a3b761e | 2 | public boolean useCardAsk(int id) throws JSONException {
boolean use = true;
try {
use = getConfig().getBoolean("Karten");
} catch (JSONException e) {
}
return (use && useCard(id));
} |
ef47b80e-994d-4ccb-b699-f52d898bb33d | 6 | public void drawSelectionArea() {
if (instance.multipleSelected()) {
if (instance.selectionWidth < 0) {
instance.selectionWidth *= -1;
instance.selectionX -= instance.selectionWidth;
}
if (instance.selectionHeight < 0) {
instance.selectionHeight *= -1;
instance.selectionY -= instance.selectio... |
22574c23-423b-4c59-bf57-3f752ae78681 | 3 | public static void main(String[] args) throws FileNotFoundException{
//-686902
answer =0;
inputgraph();
explored.add(1);
for(int j = 0; j <501; j++){
findnextvertextotraverse();
System.out.print(vertextotransverse);
System.out.print("\n");
explored.add(vertextotransverse);
answer = answer + e... |
a86f21f7-ba04-4b65-ab8f-0e557085f4e8 | 1 | @Override
public void drawImage(){
if (seenButtonTime > 20){
image.draw(x,y);
}
} |
a029fca5-6591-415f-a081-bd260c560c85 | 2 | public void testPropertyCompareToDayOfMonth() {
DateTime test1 = new DateTime(TEST_TIME1);
DateTime test2 = new DateTime(TEST_TIME2);
assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0);
assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0);
assertEquals(true, test1... |
634f16ab-485a-4801-9043-26be566c9feb | 3 | @Override
public void wdgmsg(Widget sender, String msg, Object... args) {
if(sender == start){
timer.start();
updbtns();
} else if(sender == stop){
timer.stop();
updbtns();
} else if(sender == delete){
timer.destroy();
TimerController.getInstance().save();
ui.destroy(this);
} ... |
ef939247-ac12-4719-9d47-673374522255 | 0 | public ReverseIterable(List<T> source)
{
this._source = source;
} |
f1639eaa-791b-41e0-864c-f49a84904907 | 5 | public Config(String configname, String type){
config = new File(configname + ".txt");
if(!config.exists()){ //If it does not exists, we create a new file and add defaults
try {
config.createNewFile();
r = new BufferedReader(new FileReader(config));
p = new PrintWriter(config);
if(type.equals("Se... |
977b9817-0ba5-407c-98b2-906cb4fee686 | 2 | public List<Card> getSortedFrenchDeck() {
List<Card> sortedFrenchDeck = new ArrayList<Card>();
for (Suit suit : Suit.values()) {
for (Rank rank : Rank.values()) {
sortedFrenchDeck.add(new Card(suit, rank));
}
}
return sortedFrenchDeck;
} |
23689225-ad6a-48e9-bb89-c122f235e8f3 | 2 | public void add(final String path, final Object rule) {
String pattern = path;
if (path.startsWith("*/")) {
pattern = path.substring(1);
lpatterns.add(pattern);
} else if (path.endsWith("/*")) {
pattern = path.substring(0, path.length()... |
64b24f16-f331-49bc-984a-8fd9196a43b8 | 0 | public void getSysDate() {
date = gregorianCalendar.getTime();
sysNowTime = (date.toString()).split(" ");
} |
6cc5ab1f-0128-4725-abae-71a6a22c4fc3 | 5 | @Override
public int willingnessToMoveHere(Hero hero, Player player, float distance,
int day) {
if (color == player.getColor()) {
return 0;
} else if (Mission.getLastInstance().isAlly(hero.getColor(), getColor())) {
return -1;
}
float moveRatio = hero.getMovePoints()/(distance+1);
float result... |
9ea78e8e-678c-47cd-95db-22d5c319c82f | 7 | public Long getLong(Object value) {
if (value == null) {
return null;
} else if (Integer.class.isInstance(value)) {
return ((Integer) value).longValue();
} else if (Long.class.isInstance(value)) {
return (Long) value;
} else if (String.class.isInstance... |
11fbddd9-0faa-4f42-a344-ad4ff8189be5 | 4 | private Boolean parseFirstDigit(int[] triplet){
if (peek().type != TokenType.DIGIT){ return null; }
// If we start with a digit, it could either
// be the entire triplet or it could be before a HUNDRED
int dValue = consume().value;
// If next token isn't HUNDRED, this di... |
7e369ae3-1893-4814-8ba0-c210028afaf3 | 0 | public Priest() {
super(new HolyHit(), new Compel(), new EternalFlame(), 10.0, 20.0, 70.0, 30.0, 30.0, 60.0, "Priest",400,200);
} // End DVC |
13484f2f-6bfd-4f5b-89f8-817b95e900e1 | 2 | public static boolean argumentsValid() {
boolean result = true;
for (Argument arg : arguments.values()) {
result = result && arg.isValid();
}
return result;
} |
9baf3ed1-1517-422e-ba2b-21d74cb21083 | 2 | public static ResultSet execQuery(String strSql)
{
try
{
stmt = conn.createStatement();
} catch (SQLException e)
{
System.out.println("Create Statement Failed :" + e);
e.printStackTrace();
}
try
{
rs = stmt.executeQuery(strSql);
} catch (SQLException e)
{
System.out.println("Quer... |
89eb2dfe-4b79-499d-beaa-e24936529128 | 6 | public boolean download(){
ArrayList<Peer> peers = tracker.requestPeers(this);
Peer p = peers.get(0);
Thread t = new Thread(p);
System.out.println("new peer: " + p.getIP());
t.start();
pieceIndex = getNextPiece(p);
while(running){
if(pieceIndex >= 0){
int offset = 0;
int pLen = pieceLength(... |
dc794784-53f7-4891-beed-65384af0db43 | 2 | public ListNode removeNthFromEnd(ListNode head, int n) {
if(null == head) return head;
ListNode result = new ListNode(0);
result.next = head;
int length = getLengthOfList(head);
int moves = length - n;
ListNode pointer = result;
int inde... |
61bf41ea-95d3-45c9-b26c-89ff5e3336a1 | 2 | public boolean isPending() {
if(isConfirmed == false && isRejected == false)
return true;
else
return false;
} |
ca07fa53-ff0c-4934-ad40-06d41e29460e | 4 | public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... |
795f59cc-12f8-49f7-b9cb-386aa03f8b54 | 5 | private void getAll(TreeNode node) {
String l = "0";
String r = "0";
String p = "0";
if (node.left != null) {
l = node.left.value;
}
if (node.right != null) {
r = node.right.value;
}
if (node.parent != null) {
p = node.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.