method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
43c7a813-0844-42ff-8fec-60acec0b4470 | 0 | public static void main(String[] args) {
PatchingArray patchingArray=new PatchingArray();
int[]nums={1,3};
int n=6;
System.out.println(patchingArray.minPatches(nums,n));
} |
d6129c2b-0932-4127-a682-f5cceac7a8bb | 1 | public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
// Taking one line at a time
String line = value.toString();
// The regex to split the line on
String regex = "[^a-zA-Z]";
String[] pieces = line.split(regex);
// Iterating thr... |
8108fffc-e750-433e-b833-affef5378e48 | 1 | public void setLocals(final LocalDebugInfo[] locals) {
if (code != null) {
code.setLocals(locals);
}
} |
579dbcfa-150e-46d2-94a1-1150d12b0a03 | 1 | private void lookupName(String cmd, InputStream ins, OutputStream outs)
throws IOException
{
ObjectInputStream in = new ObjectInputStream(ins);
String name = DataInputStream.readUTF(in);
ExportedObject found = (ExportedObject)exportedNames.get(name);
outs.write(okHeader);
... |
d1a1504d-a012-49ef-b2c9-80679c0a1104 | 2 | public void testPropertyAddYear() {
DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime copy = test.year().addToCopy(9);
assertEquals("2004-06-09T00:00:00.000+01:00", test.toString());
assertEquals("2013-06-09T00:00:00.000+01:00", copy.toString());
copy = test... |
4c01dbad-26e6-49c9-9776-20231e8de917 | 7 | public byte[] encrypt(byte[] text, String key){
// System.out.println("encrypting");
byte[] textEncrypted = null;
try{
//keygenerator.init(bits); // 192 and bits bits may not be available
byte[] keyPadded = new byte[bits / 8];
for(int i = 0; i < bits / 8 && i < key.length(); i++){
keyPadded[i] = ... |
f58e3f09-11d9-4d0b-8db4-bc797a8c5b0c | 9 | public void userLost() {
Platform.runLater(new Runnable() {
@Override
public void run() {
switch (state) {
case SUPER_FREE:
break;
case FREE:
state = States.SUPER_FREE;
... |
5fcb498e-d9e9-486b-8420-bdd02ff6b802 | 4 | private void initSimulationPanel() {
simulationPanel = new JPanel();
simulationPanel.setLayout(new BoxLayout(simulationPanel, BoxLayout.Y_AXIS));
final JLabel lblSimulation = new JLabel("Simulation");
lblSimulation.setFont(new Font("Tahoma", Font.BOLD, 11));
simulationPanel.add(... |
596dfa1a-ab96-4ca8-9d65-318f3e8eb557 | 1 | private static int getSmart(ByteBuffer buffer) {
byte v = buffer.get(buffer.position());
if (v >= 0)
return buffer.getShort() & 0xffff;
else
return buffer.getInt() & 0x7fffffff;
} |
5d2ac805-663c-4fd4-b2fb-a72958ba9cc1 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Product other = (Product) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
... |
efab4c09-b540-46ff-9654-a051d71811c9 | 8 | public MessageFromTablet readData(Socket tabletSocket) {
int numBytesRecv = 0;
MessageFromTablet messageFromTabletAux = null;
String inputLine = new String();
bRecv = new char[BUFFER_LENGTH];
try {
sb = new StringBuffer(); // Buffer where concatenate Strings
// received
while ((numBytesRecv = ... |
5d9cfd6a-d365-4257-a013-676dfc6f220e | 4 | public boolean connect(String ip, int port) {
try {
clientSocket = new Socket(ip, port);
outToServer = new ObjectOutputStream(clientSocket.getOutputStream());
inFromServer = new ObjectInputStream(clientSocket.getInputStream());
while (((String)inFromServer.readObject()).startsWith("1")) {
client.reque... |
b1182de7-291b-430a-80e0-93605941050a | 5 | @Override
public void refreshMachineState(IMachine machine) throws InvalidObjectException, ConnectorException {
try {
String vmName = machine.getName();
MachineState currentState = machine.getState();
VappClient vApp = VappClientLocator.getInstance().getVApp(machine, controllerServices);
if(currentSt... |
03aa7cff-43e3-4d1f-a990-d136c297a967 | 4 | public int addEmployee(String fName, String lName, String password, int authLevel)
{
for(int x = 0; x < listOfEmployees.size(); x++)
{
if((getEmployee(x).getFirstName().equals(fName) && getEmployee(x).getLastName().equals(lName)))
return -1;
else if(getEmployee(x).getLoginCode().equals(password))
ret... |
3bf44623-148f-44ab-aec6-253a2f73a529 | 9 | public synchronized void execute(Runnable r) {
if(!(r instanceof HdAsyncTaskFuture)){
return;
}
BdAsyncTaskRunnable runnable = new BdAsyncTaskRunnable((HdAsyncTaskFuture<?>)r) {
public void run() {
try {
try{
if(getPriority() == HdAs... |
702d23e5-f326-47e6-8482-e951be39c905 | 8 | public int longestConsecutive(int[] num) {
int n = num.length;
if (n<=1) return n;
HashSet<Integer> set = new HashSet<Integer>();
for(int i = 0; i < n; i++){
set.add(num[i]);
}
int l = 1;
while(!set.isEmpty()){
int start =... |
00c6bde0-9428-48c1-b423-37dfb3aaa6bc | 3 | private static void deleteFileOrDirectory( final File file ) {
if ( !file.exists() ) { return; }
if ( file.isDirectory() ) {
for ( File child : file.listFiles() ) { deleteFileOrDirectory( child ); }
}
else {
file.delete();
}
} |
aa7d34cc-6b30-4a6f-9e82-c0d38cac3b45 | 7 | void find(int pos){
if(pos==n){
int count=0;
for(int i=1; i<n; i++){
for(int j=0; j<i; j++){
if(d1[i][j]+d2[p[i]][p[j]]+2==k) count++;
}
}
if(result<count) result=count;
return;
}
for(... |
51fbf333-bca4-4ff3-935d-9fa99da06ca3 | 6 | public static int timeComplexityOptimized(int[] input){
if(input.length <=0){
System.out.println("Input array contains no elements");
return 0;
}
int sum = 0;
int mostCommonInteger = input[0]; // To store the most common integer
int highestReoccurrenceCount = 0; // To store the repeat count
i... |
4f92a24f-b1fa-4666-9901-902f81b36800 | 6 | final void method620(Class101 class101) {
method693(SafeToolkit.anIntArray5140, class101);
int i = 0;
if (((i) this).aClass129Array5119 != null) {
for (int i_74_ = 0; i_74_ < ((i) this).aClass129Array5119.length;
i_74_++) {
Class129 class129 = ((i) this).aClass129Array5119[i_74_];
((Class129) class129).a... |
cda1afe8-4b78-4830-a13b-8c903b2aebd6 | 8 | public void rollOver() {
calcMaxAndMinBackupIndex(this.fileName);
if (this.qw != null) {
long size = ((CountingQuietWriter) this.qw).getCount();
LogLog.debug("rolling over count=" + size);
this.nextRollover = (size + this.maxFileSize);
}
LogLog.debug... |
5025af80-ff57-4335-9d3d-91001d0ef67a | 7 | @Override
public String lookup(String barcode) {
String productDesc = "";
if(!(barcode == null || barcode.equals(""))){
URL url;
HttpURLConnection connection;
try {
url = new URL("http://www.searchupc.com/handlers/upcsearch.ashx?request_type=" +
"3&access_token=359D872A-2B27-4994-93A5-BEDE... |
f6479351-35c5-4ebb-880f-eb26a3375143 | 7 | public void applyDamageEffect(Entity e){
if(e instanceof Mob)
((Mob) e).damage(damageStrength, damageType, owner);
else
e.damage(damageStrength, damageType);
playDamageSound(e);
//apply special effect
switch(ID){
case "chillyWind": //instantly freeze the victim
if(!e.frozen)
e.freeze();
b... |
c998ca10-c08d-4d23-9010-a86e5f2060dc | 5 | private String findYoungestBackup(Pattern fileNamePattern) {
List<FTPFile> files = ftp.listFilesInDirectory("/");
FTPFile youngest = null;
for (FTPFile file : files) {
if (fileNamePattern.matcher(file.getName()).matches()) {
if ((youngest == null) || (youngest.getTim... |
0f0b6acd-bd02-4c9b-a031-5f001134c81f | 9 | void testValidForAppend() {
if (_size == 0 || _size > 1 && _bytes[_size - 1] == 0 || _inKeyCoder)
return;
int b = _bytes[_size - 1] & 0xFF;
if (_size == 1) {
if (b == TYPE_LEFT_EDGE) {
throw new IllegalArgumentException("append to LEFT_EDGE key");
... |
78184f42-dce4-4db7-a120-093751f18571 | 9 | public Road getRoad(Intersection i1, Intersection i2)
{
for (Road r : level.roads)
{
if (((r.node1.x == i1.x && r.node1.y == i1.y) &&
(r.node2.x == i2.x && r.node2.y == i2.y)) ||
((r.node1.x == i2.x && r.node1.y == i2.y) &&
(r.node2.x == i1... |
a3106b0c-38bd-4c3f-9ccb-5d00ede47c8f | 2 | public boolean addTag(String tag) {
if (this.tags == null) {
this.tags = new ArrayList<String>();
}
if (!this.tags.contains(tag)) {
return this.tags.add(tag.trim().replace(' ', '_'));
}
return false; //returns false if tag is already in the list
} |
070d9377-419a-49ea-872c-6a2be18dcb97 | 9 | private static void processItem(final XMLStreamReader reader,
final Writer writer, final String[] columns, final Filters filters,
final Remappings remappings, final char separator,
final boolean trim, final boolean join, final String parentElement,
final Map<String, List<... |
3930f945-ab98-4abf-a9f7-a66374559021 | 9 | public static String response(String input, DictSkipList<String, String> dictionary) throws InvalidFormatException, IOException
{
//check for dictionary, no punctuation
if (dictionary.containsKey(input.toLowerCase()))
{
return dictionary.get(input.toLowerCase());
}
//generate response
InputStream is = n... |
c22aaec8-dac3-45fd-88eb-e37911a55d73 | 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... |
242426e0-5afa-4882-9f5c-cf1b0f620b71 | 6 | protected void createSubbands()
{
int i;
if (mode == Header.SINGLE_CHANNEL)
for (i = 0; i < num_subbands; ++i)
subbands[i] = new SubbandLayer2(i);
else if (mode == Header.JOINT_STEREO)
{
for (i = 0; i < header.intensity_stereo_bound(); ++i)
subbands[i] = new SubbandLayer2S... |
688666ab-0336-4bc0-bc6d-8621aba53454 | 2 | public ShipBlueprint getShip( String id ) {
ShipBlueprint result = ships.get(id);
if ( result == null ) // TODO: Auto ships might need their own method.
result = autoShips.get(id);
if ( result == null )
log.error( "No ShipBlueprint found for id: "+ id );
return result;
} |
37fc0557-d7e1-477a-acda-038ac38e841f | 4 | boolean correctClassifier(double[] x, String y)
{
double classifier = 0.0; // A temporary variable to store the classifier label.
// Use implicit classifier to calculate (dot(w, phi(x)) - theta)
for (int j = 0; j < trainingSetSize; j++)
{
classifier += c[j]*(Math.pow((1 + dotProduct(x, data.storage[trainin... |
fee3042f-6186-40da-9d83-6d638700cf8f | 3 | public void show(){
for(int i=1; i<=size; i++){
for(int j=1; j<=i; j++){
System.out.print(pascalsTriangle[i][j]);
if(j!=i){
System.out.print(",");
}
}
System.out.println();
}
} |
e1d8774c-f94d-4918-af8b-a0a29ddaa5c0 | 1 | public static String hexagon(Coordinate center, double radius) {
Coordinate corner = center.sub(Coordinate.Y.neg().scale(radius));
String res = "G36*\n" + String.format("X%dY%dD02*\n", (int)(corner.x), (int)(corner.y));
// for(int i=1; i<6; i++) {
for(int i: new int[] {1,2,3,4,5}) {
corner = corner.sub(center)... |
a5bb66f0-0667-4b17-a98c-a561ed8f7f18 | 2 | private static void realizarParser() throws FileNotFoundException, InvalidCantidadDeTokensDeLookaheadException, BufferDeTokensVacioException, IOException {
//Salto de linea
System.out.println();
// Formato de impresion extendido 1 o 2
int i = 1;
... |
38aa86ff-d844-4595-8274-d17f421463c1 | 0 | void Initialize(InitPack ip) {
this.sectionID = ip.getID();
System.out.println(ip.getID());
this.stable = 0;
this.updating = 1;
this.threshold = ip.getThreshold();
this.width = ip.getWidth();
this.height = ip.getHeight();
this.temps = new long[2][width][he... |
26c26d21-c9f7-4c0e-907d-57a2ffebccef | 5 | private int[] merge(int[] left, int[] right) {
int leftLen = left.length, rightLen = right.length;
int leftPos = 0, rightPos = 0;
int[] result = new int[leftLen + rightLen];
int resultPos = 0;
while(leftPos < leftLen && rightPos < rightLen) {
if(left[leftPos] < right[... |
e2c7541c-e4c9-49ea-8398-db9b611ca2e1 | 9 | public void crossJoin(){
Iterator BindingVectorIt = queue.keySet().iterator();
// System.err.println(" === DEBUG (RETEQueue::crossJoin) : queue contains " + queue.size() + " triples, sibling contains "+ sibling.queue.size() + " triples.");
while(BindingVectorIt.hasNext(... |
8e02403f-cad5-4e0b-830d-a380adfbc78c | 6 | public void run() {
serverQuery.getLogger().info("Input thread spawned");
// Instantiate a TS3 Reader object
TS3Reader reader = new TS3Reader(new InputStreamReader(stream));
try {
// Skip the first 2 lines (as they are just a welcome message)
for(int i = 0; i < ... |
8fdd4976-5477-4396-a08e-e9bd214cea5e | 9 | public static String[] getConvertableUnits(String myUnit){
String[] a = {};
if(length.contains(myUnit))
return length.toArray(a);
if(mass.contains(myUnit))
return mass.toArray(a);
if(capacity.contains(myUnit))
return capacity.toArray(a);
if(area.contains(myUnit))
return area.toArray(a);
if(spee... |
8f8a1374-fd74-423e-9a94-51d319bc4dd2 | 0 | public BaseDO findByPrimaryKey(final Object key) {
final BaseDO baseDO = (BaseDO)getEntityManager().find(getObjectType(), key);
return baseDO;
} |
818fd940-b2e0-4044-b875-71164a415de3 | 1 | final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
jj_gen++;
return token;
} |
c17b956f-c904-4af1-9c00-6491a7937e63 | 0 | public City getFirstCity(){
return first_city;
} |
bd95203e-a4f7-491c-892e-7444ed89284f | 0 | public static void main(String[] args) {
//Se llama a la clase menu del paquete Intefaz
Menu menu = new Menu();
menu.setVisible(true);
} |
90d1460f-4c82-48df-8001-f1a9de810470 | 5 | public void genEnergyType(){
rand = new Random();
energyRoll = (rand.nextInt(5)+1);
if(energyRoll == 1){
energyType = "Acid";
} else if(energyRoll == 2){
energyType = "Cold";
} else if(energyRoll == 3){
energyType = "Fire";
} else if(energyRoll == 4){
energyType = "Electricity";
} else if(e... |
af798319-5067-4795-bd8d-40264fa28665 | 0 | @SuppressWarnings("unchecked")
public List<Task> getActiveForPeriod(Journal journal, Date startDate, Date endDate) {
Query query = sessionFactory.getCurrentSession().createQuery(
"from ru.stereohorse.polypus.model.Task task " +
"left join fetch task.steps step " +
... |
a7d25ac7-dafc-4d44-abe3-3dde7477c205 | 0 | public void rotate(int angle)
{
} |
c66ed489-6772-4327-b428-3829e4d9a985 | 9 | public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
int var6 = var1.getBlockMetadata(var2, var3, var4);
boolean var7 = false;
if(var6 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
var7 = true;
}
if(var6 == 3 && var1.isBlockNormalCube(... |
d5b60a17-8bbf-4f37-9c6a-9e45bbe72fec | 1 | public void testPrint_appendableMethods() throws Exception {
DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC);
StringBuilder buf = new StringBuilder();
f.printTo(buf, dt);
assertEquals("Wed 2004-06-09T10:20:30Z", buf.toString());
buf = new StringBuilder();
... |
3e4e56d0-aa53-4c67-bbc8-b2e723321504 | 5 | public void setTestInfo(TestInfo testInfo) {
if (testInfo == null)
testInfo = new TestInfo();
try {
this.setProperty(Constants.TEST_NAME, testInfo.getName());
this.setProperty(Constants.TEST_ID, testInfo.getId());
this.setProperty(Constants.TEST_NUMBER_OF... |
e1196367-2c1e-42fc-bc3c-9dced92d8d0a | 5 | public int cdlStalledPatternLookback( )
{
return ((( ((( (this.candleSettings[CandleSettingType.BodyLong.ordinal()].avgPeriod) ) > ( (this.candleSettings[CandleSettingType.BodyShort.ordinal()].avgPeriod) )) ? ( (this.candleSettings[CandleSettingType.BodyLong.ordinal()].avgPeriod) ) : ( (this.candleSettings[Can... |
9dda5ffd-7d39-4385-a207-40e1cb5a9057 | 4 | public void DeleteArrow()
{
if(playerEquipmentN[playerArrows] == 0)
{
deleteequiment(playerEquipment[playerArrows], playerArrows);
}
if(playerEquipment[playerWeapon] != 4214 && playerEquipmentN[playerArrows] != 0){
outStream.createFrameVarSizeWord(34);
outStream.writeWord(1688);
outStream.writeByte(playerAr... |
743c5fd7-c1d0-49ba-85c5-dc70f2293f7b | 3 | private static Bitmap[] loadSplit(String name, int sw, int sh) {
try {
BufferedImage bi = ImageIO.read(Art.class.getResource(name));
int w = bi.getWidth();
int h = bi.getHeight();
int xs = w / sw;
int ys = h / sh;
Bitmap[] bitmaps = new B... |
b34cdf3c-44d5-481a-973f-0df006214e74 | 3 | @Test
public void testMoveForwardUnlanded() throws UnlandedRobotException {
exception.expect(UnlandedRobotException.class);
Robot r = new Robot();
try {
r.moveForward();
} catch (InsufficientChargeException e) {
e.printStackTrace(); //To change body of catch ... |
35b408a4-eeed-42ab-80a8-ee33988dfc19 | 8 | public void render(Graphics g)
{
if(health > 0)
{
g.drawImage(Images.player[walkFrame][skin],(int)x,(int)y, null);
if(gunLevel > 0)
{
g.drawImage(Images.gun[walkFrame][gunLevel - 1], (int)x,(int)y, null);
}
if(level.debug)
{
... |
bb4bfd3a-5678-4649-8c15-de23c627af81 | 2 | public void schemeEditorDelOutput() {
if(ce_output.getSelectionIndex() == -1) return;
String outputName = ce_output.getText();
Contact contact = new Contact(outputName, -1);
for(String circuitName : scheme.getCircuits().keySet()) {
Circuit circuit = scheme.getCircuit... |
9147df57-9260-4b82-9754-d90d6d932d75 | 7 | public void populateMaze() {
// Populate array with the walls
for (Node wall : wallList) {
// System.out.println("Get X: " + wall.getX() + " Get Y: " + wall.getY());
this.maze[wall.getX()][wall.getY()] = "#";
}
// Populate array with the empty spaces & goal
for (int x = 0; x < size.getX(); x++) {
fo... |
d115d744-6bd4-4874-9db1-6dae957d247e | 1 | public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
return new SAXAnnotationAdapter(getContentHandler(),
"parameterAnnotation", visible ? 1 : -1, parameter, desc);
} |
ea9c92df-9766-4e76-8372-5a3e190390dd | 8 | public void checkFiles() {
List<LeafNode> leaves = getLeaves();
if ( leaves != null ) {
ListIterator<LeafNode> it = leaves.listIterator();
while ( it.hasNext() ) {
LeafNode node = it.next();
// Check finished files
... |
a330dc48-63cc-479e-8d74-beaab13aaff2 | 5 | public void readXML() {
try {
File xmlFile = new File("basedados.xml");
DocumentBuilderFactory documentFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder documentBuilder = documentFactory
.newDocumentBuilder();
Document doc = documen... |
577dd680-380f-4a78-a3c5-fdd77c0755c2 | 6 | public static TreeSet<IdFloat> topList(final HugeFloatMatrix floatMatrix, final int column, final int topN) {
final TreeSet<IdFloat> topList = new TreeSet<IdFloat>(new Comparator<IdFloat>() {
public int compare(IdFloat idFloat, IdFloat idFloat1) {
if (idFloat.vertexId == idFloat1.ver... |
cd35f9f0-3f9e-4bfa-bee4-ccefb43ea2ad | 0 | public Boolean isFinished() {
return isFinished;
} |
621bd31e-6378-4136-805a-788117044809 | 6 | public void cargarArbol() {
r_con.Connection();
int count = 0;
int aux = 1;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
parent1 = (DefaultMutableTreeNode) e.nextElement();
if (count >= aux) {
try {
... |
00994932-bdf8-4854-9b85-873551142975 | 7 | @Override
public void print() throws AnimalException {
System.out.println("\tInformatii animal:");
if (this.getNumeAnimal() == null)
throw new AnimalException("Animal's name is invalid!");
if (numeStapan == null)
throw new AnimalException("Owner's name is invalid!");
if (this.getOrigine() == null)
... |
3b0687d5-ea7d-4510-8c29-4718ed1e60da | 7 | @Override
public boolean unregister(CommandMap map) {
List<String> toRemove = new ArrayList();
Map<String, Command> knownCommands = KNOWN_COMMANDS.get(map);
if (knownCommands == null) {
return false;
}
for (Iterator<Command> i = knownCommands.val... |
a57e2adc-f4f6-426f-b195-aab2f75ee9b7 | 8 | private boolean matchesStepOneTopCross() {
RubiksCube rc = this.initialRcConfig;
// Get top face center cubie
Cubie topFaceCenterCubie = rc.getCubie(2, 3, 2);
// Get upperRight corner Cubie of front face
Cubie frontFaceUpperRightCubie = rc.getCubie(3, 3, 3);
// We are just after priming the cube so... |
31361815-5010-443e-8c7c-500af02d04b8 | 9 | Point moveSheep(int sheepId) {
Point thisSheep = sheeps[sheepId];
double dspeed = 0;
Point closestDog = getClosestDog(sheepId);
double dist = distance(thisSheep, closestDog);
assert dist > 0;
if (dist < RUN_DIST)
dspeed = RUN_SPEED;
else if (dist < WA... |
8156d6e5-b71d-44f6-94a9-21181832ad94 | 4 | private void globalBroadcast(int level, String[] keywords) {
if (isAccountTypeOf(level, ADMIN, MODERATOR)) {
if (keywords.length > 1) {
if (servers != null) {
String message = Functions.implode(Arrays.copyOfRange(keywords, 1, keywords.length), " ");
for (Server s : servers) {
s.in.println("say ... |
b48b0994-4a0b-4425-97d6-0dbe5a53f812 | 1 | public static ComponentUI createUI(JComponent c) {
if (System.getSecurityManager() != null) {
return SAFE_VERTICAL_LABEL_UI;
} else {
return verticalLabelUI;
}
} |
dd6200bb-8d57-4421-908d-5ad582f9b62e | 5 | public State[] getStatesOnTerminal(String terminal, State[] states,
Automaton automaton) {
ArrayList list = new ArrayList();
for (int k = 0; k < states.length; k++) {
State state = states[k];
Transition[] transitions = automaton.getTransitionsFromState(state);
for (int i = 0; i < transitions.length; i++... |
c87a9215-c452-49df-91ec-de5b50a24e73 | 7 | @Override
protected boolean isDirty()
{
boolean dirty = super.isDirty();
if (dirty)
{
return true;
}
else if (isCheckingDirtyChildPainters())
{
for (Painter<T> p : painters)
{
if (p instanceof AbstractPainter)
{
AbstractPainter<?> ap = (AbstractPainter<?>) p;
if (ap.isDirty())
... |
89b78332-5254-4eb2-a922-96900ef3057b | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
45bd15dd-4795-4499-984b-4691b12192af | 6 | public boolean inBank() {
if (!LocationAttribute.EDGEVILLE.isInLargeArea(ctx)) {
final Locatable nearest = ctx.bank.nearest();
if (IMovement.Euclidean(ctx.players.local(), nearest) < 8) {
return true;
}
}
for (Task node : tasks) {
if (node != null && node instanceof NodePath && ((NodePath) node).... |
cbd08e3d-cc38-4af6-b0d2-98263247d352 | 6 | @Override
public void update() {
super.update();
if(flinching){
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if(elapsed > 400) flinching = false;
}
if(right && dx == 0){
right = false;
left = true;
fa... |
5c229845-1e88-4058-9ed7-f7fd802753fb | 1 | private String formatTR(String content) {
String buf = "";
int idx = 0;
int aStart = 0;
int aEnd = -5;
while (content.indexOf("<tr", idx) != -1) {
aStart = content.indexOf("<tr", idx);
//buf += content.substring(aEnd+5, aStart);
aStart = content.indexOf(">", aStart)+1;
aEnd = content.indexOf("<... |
aa0ade6c-dd40-46db-a2a0-648beb089b89 | 4 | public boolean SetTime(int responseTime){
boolean test = false;
if (test || m_test) {
System.out.println("ConnectFourAI :: SetTime() BEGIN");
}
m_time = responseTime;
if (test || m_test) {
System.out.println("ConnectFourAI :: SetTime() END");
}
return true;
} |
102fa301-9e5a-473c-8ec9-8ee9aa336483 | 9 | protected void computeFloor(final float[] vector) {
int n=vector.length;
final int values=xList.length;
final boolean[] step2Flags=new boolean[values];
final int range=RANGES[multiplier-1];
for(int i=2; i<values; i++) {
final int lowNeighbourOffset=lowNeighbours[i];//Util.lowNe... |
64001fa1-352a-4394-9759-c0fddbd56e53 | 0 | public void removeChangeListener(ChangeListener listener) {
listeners.remove(listener);
} |
2389c84e-8d87-423a-a8ba-4e8eef572f62 | 7 | @Override
public void reloadAutoTitles()
{
autoTitles=new TriadSVector<String,String,MaskingLibrary.CompiledZMask>();
final List<String> V=Resources.getFileLineVector(Resources.getFileResource(this.getTitleFilename(),true));
String WKID=null;
for(int v=0;v<V.size();v++)
{
final String row=V.get(v);
WK... |
02cc079a-b571-4223-b252-13ce2fc6fdfd | 7 | public EditorToolBar(final BasicGraphEditor editor, int orientation)
{
super(orientation);
setBorder(BorderFactory.createCompoundBorder(BorderFactory
.createEmptyBorder(3, 3, 3, 3), getBorder()));
setFloatable(false);
add(editor.bind("New", new NewAction(),
"/com/mxgraph/examples/swing/images/new.gif"... |
016274da-7197-46b3-9a09-862168cbf65e | 2 | public void insertString (int offset, String str, javax.swing.text.AttributeSet attr) throws BadLocationException {
if (str == null)
return;
if ((getLength() + str.length()) <= limit){
super.insertString(offset, str, attr);
}
} |
bd2acf67-d883-4b5f-9569-11150004e35e | 3 | @Override
public Value get(Key key)
{
if (isEmpty())
return null;
int i = rank(key);
if (i < N && key.compareTo(keys[i]) == 0)
return vals[i];
return null;
} |
1d301816-b357-4f57-a2e3-554a37a20e3f | 9 | * @return An <code>Element</code> encapsulating this action.
*/
public Element enterRevengeMode(ServerPlayer serverPlayer) {
if (!getFreeColServer().isSinglePlayer()) {
return DOMMessage.clientError("Can not enter revenge mode,"
+ " as this is not a single player game.");
... |
0a454bfe-92dc-4b9b-827f-6920cc070ea0 | 4 | private void clearGraph(States state) {
for (int i = 0; i < N; i++) {
if (state == States.ARR_ADJ)
Arrays.fill(arr_adj[i], 0);
if (state == States.ARR_INC)
Arrays.fill(arr_inc[i], 0);
if (state == States.LIST_ADJ)
list_adj[i] = new ArrayList<ListNode>();
}
} |
98a83940-de7b-4767-86a7-b0dd5cb8ac8a | 6 | public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
long lastTimer = System.currentTimeMillis();
delta = 0D;
while (true) {
long now = System.nanoTime();
delta += (now - lastTime) / nsPerTick;
lastTime = now;
// If you want to limit frame rate, shouldRen... |
b86ec818-5403-463e-ab6e-5b191973f9a8 | 2 | public static Type get(char c) {
for (Type t : Type.values()) {
if (t.equals(c)) {
return t;
}
}
return null;
} |
5d15a50b-17bf-4daf-842b-0ddf91f706c8 | 2 | public static void splitText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
// Get Text for nodes.
String oldText = currentNode.getValue();
String oldNodeText = currentNode.getValue().substring(0,textArea.getCaretPosition());
String newNodeTe... |
d9c98410-0559-4eb2-ac55-059286ab4253 | 9 | public static void main(String[] args) {
final TileTypeConfiguration tileTypeConfiguration = new TileTypeConfiguration();
TileType whiteTileType = new TileType("white");
tileTypeConfiguration.put(whiteTileType, loadImage("images/white.png"));
TileType blackTileType = new TileType("black");
... |
70749cf4-d7bb-4181-a912-8203748d6f19 | 3 | public Image getCurrentImage() {
BufferedImage[] images = null;
if((images = this.animations.get(this.information.getCurrentAnimationType())) == null || images.length == 0){
return currentImage;
}
if(this.animationCounter >= this.animationCounterMax){
this.animationCounter = 0;
}
currentImage = images... |
2204dd5f-1149-467d-8908-478b08fbc1cf | 2 | @Override
public void execute(Player player, String[] args)
{
if(args.length == 1)
{
LevelHandler handler = player.getServer().getLevelHandler();
Level level = handler.findLevel(args[0]);
if(level != null)
{
player.changeLevel(level);
} else {
player.sendMessage("Level doesn't exist...");
... |
cbdab164-3d21-4fc0-b8ad-a74b9deffc1e | 5 | public boolean checkAuth(Membre m) {
boolean found = false;
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst=this.connect().prepareStatement("select * from Membre where email= ? and mdp = ? and status=?");
pst.setString(1, m.getEmail());
... |
18568c23-6c3a-4661-bd9e-54202dec4d37 | 5 | public byte[] getEncoded() {
if (isSourceConsistent) {
return sourceObject.getEncoded();
}
try {
Iterator<Integer> it = tagList.iterator();
String tagValues = "";
Vector<BERTLVObject> objs = new Vector<BERTLVObject>();
while (it.hasNext()) {
short tag = it.next().shortValue();
tagValues += ... |
5da4bfa8-8218-4fa3-873e-9d5845598f5c | 0 | public NoEmailKontaktFoundException(String message) {
super(message);
} |
fdbf991b-a3de-4908-b8b4-d0d5fbec6fdf | 4 | public int countDoubleCrosses()
{
DfsGraphTraversal dfs = new DfsGraphTraversal();
List<List<Integer>> connectedNodes = dfs.traverse(gameBoard);
int count = 0;
for(int i = 0; i < connectedNodes.size(); i++)
{
int graphSize = connectedNodes.get(i).size();
if(graphSize == 2)
{
int v = connected... |
1a882158-c4d2-4ece-ae24-c37e07a79fdb | 7 | public static String Status(int credits, int honors, double gpa){
if ( (credits + honors) > 180 && gpa > 2.0 ){
if ( gpa > 3.6 && gpa < 3.8 ){
if ( honors < 15 ){
return "cum laude";
} else {
return "magna cum laude";
}
}
else if ( gpa >= 3.8... |
864a09d7-beda-4251-bf98-49dee32891ec | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
MediaLibAccessor srcAccessor1 =
new MediaLibAccessor(sources[0], destRect... |
cc361293-0752-4248-a753-da4e9e7a8fbc | 8 | private int findBaseHeightForLogo(int target, int associationNameLength) {
int base = 1;
double height = getLogoHeight(associationNameLength, base);
while (height < target) {
base *= 2;
height = getLogoHeight(associationNameLength, base);
LOG.debug(String.form... |
7f658d4b-8916-4022-a0e3-679e0ecdaa05 | 6 | public boolean getData() throws IOException
{
DataInputStream l_in = null;
FileOutputStream l_out = null;
long l_sizeReceived = 0;
byte []l_buffer = new byte[1024];
int l_read = 0;
/*
* Check if filename and/or socket are not null
* Check if file size is not equal to... |
70163160-d70b-4d17-86aa-5f7e8de6e06d | 9 | public void initTextures(final boolean mipmap) {
nameHandleMap.clear();
final Set<Entry<String, BufferedImage>> set = nameBitmapList.entrySet();
final int size = set.size();
final IntBuffer textureHandle = BufferUtils.createIntBuffer(size);
GL11.glGenTextures(textureHandle);
for (final Entry<String, Buffere... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.