method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
163ef39f-684e-4cc8-9eca-4ef9df6a0bb5 | 4 | private byte[] createMeshAddressingHeader(byte[] packet){
int packetPosition = 0;
byte actualByte = packet[packetPosition];
//check length of originatorAddress (xxYxxxxx)
int maskedByte = (actualByte&(byte)32) & 0xFF;
if(maskedByte == 32){
vFlag = true;
} else {
vFlag = false;
}
//check leng... |
a75e3bfe-6e1a-40fc-b8c9-4bddfeccb810 | 2 | public String getTypeSignature() {
if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeSignature();
else
return bottomType.getTypeSignature();
} |
13abb0fe-3248-4200-9e15-d5b61f29e954 | 3 | private String moveCardOntoAcePile(List<Card> from, int indexFrom, int indexTo) {
List<Card> toPile = acePiles.get(indexTo);
if (indexFrom == -1) indexFrom = from.size() - 1;
Card toMove = from.get(indexFrom);
//Assumes at least one card remaining.
Card pileTop = toPile.get(toPil... |
384fcb0e-a52c-40dd-a78c-37f2f2c15359 | 7 | public static Module load_xm( byte[] header_60_bytes, DataInput data_input ) throws IOException {
int xm_version, song_header_length, sequence_length;
int num_channels, num_patterns, num_instruments, xm_flags, idx;
byte[] structure_header, song_header;
boolean delta_env;
String tracker_name;
Instrument inst... |
7af11596-0a27-48a5-983b-e50a50a65515 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vector4 other = (Vector4) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Fl... |
d0b34c1f-6ca1-48d4-ac18-1d2bb2c7ff1a | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line), n = 0, ans = 0;
... |
ccb0a9fe-5e00-48eb-ab43-8126458b7058 | 5 | static boolean isVowel(char l) {
return l == 'A' || l == 'E' || l == 'I' || l == 'O' || l == 'U' || l == 'Y';
} |
5d6727c8-1eb0-4f61-abac-3c83d855568b | 8 | public static Stella_Object accessStellaTokenSlotValue(StellaToken self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_LOGICAL_TOKEN_TYPE) {
if (setvalueP) {
self.logicalTokenType = ((Keyword)(value));
}
else {
value = self.logicalToke... |
26e09563-88df-44b5-96d6-3c665c13c750 | 3 | public void run() {
try {
getStreams();
while (true) {
final String msg = input.readLine();
if (msg == null) {
System.out.println("Connection Lost!");
break;
}
processMessage(msg);
... |
76059b24-3cdd-4951-9fe8-76b00186809c | 8 | public void mouseMotion(Point p) {
if(headingLbl.getBounds() == null){
return;
}
if(backBtn.getLabel().getBounds().contains(p)){
backBtn.changeTextTo(btnFontMotion, btnColorMotion);
}else{
backBtn.revert();
}
if(namesBtn.getLabel().getBounds().contains(p)){
namesBtn.changeTextTo(btnFontMot... |
ba040787-e7cf-470b-a0f9-6ee74c03e9ec | 2 | public Set<BankAccount> getAccountsSatisfying(Predicate<BankAccount> predicate) {
Set<BankAccount> result = new HashSet<>();
for (BankAccount account: accounts)
if (predicate.test(account))
result.add(account);
return result;
} |
4cdc4488-48b2-4f91-a06c-c0a6b2d27edc | 8 | public static void main(String args[]) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid file input.");
}
while (inputScanner.hasNext()) {
int fizz = inputScanner.nextInt();
int buzz = inputScanner.ne... |
0b5f0789-e004-4583-bfaa-37fa18dcf47b | 6 | public static String getRemainingJailTime(String name) {
List<Prisoner> matches = Prisoner.selectWhere("player='"+name+"'");
int timeLeft = matches.get(0).getSentence_time() - matches.get(0).getServed_time();
int hours = timeLeft / 3600, remainder = timeLeft % 3600, minutes = remainder / 60, seconds = re... |
c481bfff-cb9d-47a2-bc02-724f26a0ce9d | 8 | public PrimitiveOperator combineLeftNLeftOnRight(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
// the other gate is on the left side - on the LSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 1 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[1]) ? 1 : 0... |
c67df836-afa5-43e9-a129-23a1a10898e4 | 4 | private static int findClosingParenthesis(String step, int startSearch) {
int skip = startSearch + 1; // start on the char AFTER the starting '('
int unclosedCount = 1; //we skipped the starting '(' so start at one
while (unclosedCount != 0) { //find the end of the parenthetical expression
if (step.charAt(skip... |
56cc7d71-6b9b-4bad-aea0-4c6d3c41c2e5 | 1 | public static void clearAmbient(){
File dir = new File(Params.testFolder);
for(File f : dir.listFiles())
f.delete();
dir.delete();
} |
61aa293d-b2a3-44bf-a280-1593189e978f | 8 | @Override
public void run() {
readID = Thread.currentThread().getId();
while (pm.server.Running && client.client.isConnected()) {
try {
byte opCode = reader.readByte();
PacketReceivedEvent event = new PacketReceivedEvent(client, pm.server, reader, opCode);
pm.server.getEventSystem().callEvent... |
53ef199a-4602-4990-ab9c-6f34e8accf51 | 4 | public static char[][] build_zigzag_block(String plain,int row)
{
char[][] result=new char[row][plain.length()];
int position=0;
boolean down=true;
for(int i=0;i<plain.length();i++)
{
result[position][i]=plain.charAt(i);
if(down)
{
if(position==row-1)
{
down=false;
position--;
... |
9484d50a-4087-4b7f-88e1-20af11c3e341 | 9 | private TreeNode gT(int[] inorder, int inStart, int inEnd, int[] postorder, int pStart, int pEnd){
if(inorder==null || postorder==null || inorder.length==0 || postorder.length==0 || inStart>inEnd || pStart>pEnd){
return null;
}
int childRootVal = postorder[pEnd];
TreeNode chi... |
f4ffdfe0-6711-4d46-b550-e7d6d4a6171e | 1 | public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException ex) {
throw new IncompatibleClassChangeError(getClass().getName());
}
} |
d6aa8da0-208e-48da-b1dc-42d937903956 | 0 | public AdjacencyList() {
this.adjacencyList = new DynamicArray();
} |
3835fbe3-0f45-4cc9-93d1-59c8db74bddf | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
b0b7eacb-a3b8-4f3d-886f-5e37972deb23 | 2 | private String getExtension(File f) {
String fileName = f.getName();
String extension = "";
int i = fileName.lastIndexOf('.'); //Get index of the last "." in the file name
if (i > 0 && i < fileName.length() - 1) {
extension = fileName.substring(i+1).toLowerCase(); //Extension formed from all characters fo... |
01a5798c-cf26-4e1f-817d-0036655ebd92 | 4 | public static <T extends BaseWindow> ArrayList<T> getWindows(Class<T> type) {
ArrayList<T> windows = new ArrayList<>();
Frame[] frames = Frame.getFrames();
for (Frame element : frames) {
if (type.isInstance(element)) {
T window = type.cast(element);
if (window.mWasAlive && !window.isClosed()) {
wi... |
d446b0b2-a714-48f8-8e90-4bca82831748 | 0 | public int getCharacter()
{
return character;
} |
f15e1e9f-1ef6-4af8-9b06-ec03e78f8fda | 8 | @Override
public void run() {
progressBar.setMinimum(0);
progressBar.setMaximum(100);
progressBar.setValue(0);
progressBar.setStringPainted(true);
progressPerWorker = (int) Math.floor(100 / workers.size());
numberOfWorkers = workers.size();
for (SwingWorker<Boolean, Void> worker : workers) {
synchron... |
8996707e-009f-4aa3-8905-04340fda751e | 5 | @SuppressWarnings("unused")
private void handleFailed() {
incomplete = 0;
complete = 0;
for (OnDemandRequest onDemandRequest = (OnDemandRequest) requested.getFront(); onDemandRequest != null; onDemandRequest = (OnDemandRequest) requested.getNext()) {
if (onDemandRequest.incomplet... |
b4eedd37-aa3b-466b-81d2-1041d9cd0483 | 9 | public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.guid != null) {
if (isSetGuid()) {
oprot.writeFieldBegin(GUID_FIELD_DESC);
oprot.writeString(this.guid);
oprot.writeFieldEnd();
}
}
if (this.name != n... |
0e98476b-3176-4496-973b-cfe6d0bf38e4 | 3 | protected void layout(TreeNode node)
{
if (node != null)
{
TreeNode child = node.child;
while (child != null)
{
layout(child);
child = child.next;
}
if (node.child != null)
{
attachParent(node, join(node));
}
else
{
layoutLeaf(node);
}
}
} |
ec582adf-aa4a-4ca9-b14f-09a8174efd69 | 5 | protected final static String getMessage(Class<?> caller, String errorTag, String message, Object... arguments) {
StringBuilder sb = new StringBuilder();
if (null != caller) {
String classname = caller.getName();
sb.append(classname).append(": ");
}
if (null != errorTag) sb.append(Messages.getErrorMessage... |
96b2d95e-5e4f-4e33-92cf-a5752e3ce6e0 | 4 | private static void writeChildren(Writer writer, BusinessCollection collection, int depth) {
try{
// Iterate children and write their data
for(Object object : collection.getBusinessObjects()) {
BusinessObject businessObject = (BusinessObject) object;
// Str... |
87919950-d949-435b-8d61-2a4b77f0d903 | 9 | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map<String, List<AbilityComponent>> getAbilityComponentMap()
{
Map<String, List<AbilityComponent>> H=(Map)Resources.getResource("COMPONENT_MAP");
if(H==null)
{
H=new Hashtable<String,List<AbilityComponent>>();
final StringBuffer buf=new CMFi... |
b31bfcaf-0350-45fb-9977-831af3c785a6 | 7 | public void destroy(String id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Workstation workstation;
try {
... |
adae58aa-30c7-452a-b00a-0fc5ab9be515 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
780fc598-e892-4b3a-b085-557fd2cbe998 | 2 | private void setBrickField() {
int startPositionY = BRICK_Y_OFFSET;
for (int i = 0; i < NBRICK_ROWS; i++) {
for (int j = 0; j < NBRICKS_PER_ROW; j++) {
GRect brick = new GRect((BRICK_SEP / 2) + j * (BRICK_WIDTH + BRICK_SEP),
startPositionY + i * (BRICK_HEIGHT + BRICK_SEP),
BRICK_WIDTH, BRIC... |
c4cd605f-867d-4652-af75-260aacfad7bf | 7 | @Override
public byte[] encoding(IData4Coding data) throws NoConfigException {
Bytes encodedData = new Bytes();
List<Class<? extends Object>> allTypes = data.allConfigs();
this.sortBySize(allTypes);
for (Class<? extends Object> clazz : allTypes) {
encodedData.append((byte) T... |
b42959d7-a201-4f79-bd45-6b6fb49db345 | 4 | public void addVertex(Vertex vx) {
if (!mesh.isDynamic() && !mesh.needsRenderUpdate) return;
if (vx == null) return;
if (vertices.contains(vx)) return;
vertices.add(vx);
mesh.needsRenderUpdate = true;
} |
5befb1f5-ba23-4971-b035-7287ab331a6b | 4 | public void addNode(Node newNode){
int comp = newNode.data.compareTo(data);
if (comp < 0){
if (left == null){
left = newNode;
left.parent = this;
}
else { left.addNode(newNode); }
}
else if (comp > 0){
... |
3b0f5646-20ce-456e-b471-bb6f6689a15e | 5 | private String translatePos(int row, int col) {
if (row < RowNum && col < ColNum && row >= 0 && col >= 0) {
// if the row and column number is valid for our grid
StringBuilder str = new StringBuilder();
str.append("");
str.append((char)('A' + col));
if (row < 9) {
... |
06b47dcc-3086-4d1f-bab0-b5a8206e33e7 | 8 | public static PluginConfigurator getInstance (String className) {
boolean goOn = true;
Class<? extends PluginConfigurator> configuratorClass = null;
if (goOn) {
try {
configuratorClass = (Class<PluginConfigurator>) Class.forName (className);
} catch (ClassNotFoundException ex) {
LogHelperDebug.prin... |
865f9526-e3f4-4309-b288-1d57715d8c57 | 6 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
//Botón encriptar
if (res == null){
JOptionPane.showMessageDialog(null, "No se ha elegido ninguna opción");
}else{
... |
6ed44e73-ac1d-4432-ab7c-ce7672e7fa3b | 9 | public void cast(Room room, Entity parent, float x, float y, float tx, float ty, float dx, float dy) {
Spells spell = FIREBALL;
for(Spells s : Spells.values()) {
if(name.equals(s.getName()))
spell = s;
}
switch(spell) {
case FIREBALL:
new Fireball(room, parent, x, y, tx, ty, dx, dy);
break;
... |
b2b606eb-e171-4285-be5a-9d547a35c83d | 2 | @RequestMapping(value = {"/SucursalBancaria/{idSucursalBancaria}"}, method = RequestMethod.PUT)
public void update(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idSucursalBancaria") int idSucursalBancaria, @RequestBody String json) {
try {
ObjectMapper o... |
81fa1fe2-ccf1-4978-810a-0427e8d09117 | 7 | private static void sortEvents(Score score, Vector evtList, Vector phrVct, SMF smf, Part part) {
double startTime = 0.0;
double[] currentLength = new double[100];
Note[] curNote = new Note[100];
int numOfPhrases = 0;
double oldTime = 0.0;
int phrIndex = 0;
//Go th... |
453ad967-d0b1-4445-8ea2-6fd7a647dc00 | 2 | private static String getSuchElementsCount(Map<String, String> elements, String elementName) {
int result = 0;
for (String elementDesc : elements.values()) {
if (elementDesc.equals(elementName)) {
result++;
}
}
return result + "";
} |
46a5e849-95bc-4c06-94ee-7dfe447b5b00 | 3 | private void checkSessionState(UserSession session) {
if (session.getStatus().equals(AccountServiceMessages.AUTHORIZED) || session.getStatus().equals(AccountServiceMessages.USER_ADDED)) {
session.stopWaiting();
}
if (session.elapsedTime() > UserSession.MAX_WAITING) {
sess... |
c7288781-c1e9-4b57-848a-0ebe62d5eae0 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final HolderBase<?> other = (HolderBase<?>) obj;
if (!Objects.equals(this.data, other.data)) {
retu... |
c0bb9b75-1851-4f93-9fb2-269551de1b22 | 0 | public static void main(String[] args) {
System.out.println(0.12345);
System.out.println(1.2345E-1);
System.out.println(1.2345e-1);
} |
5f5185ae-f172-40df-bfa1-5cd3ec4ff1d6 | 1 | private boolean hasPhoneNumbers(PhoneNumber... phoneNumbers) {
return phoneNumbers == null || phoneNumbers.length < 1;
} |
4c6500fb-9cb9-411f-aa67-8894b4d983a6 | 2 | @Test
public void test() {
TrieST st = new TrieST();
st.put("three", (Object)3);
st.put("four", (Object)4);
st.put("five", (Object)4);
st.put("six", (Object)4);
st.put("nine", (Object)9);
System.out.println(st.contains("four"));
System.out.println(st.contains("five"));
System.out.println();
... |
752a0abd-4820-4a04-b840-7e9c354fa035 | 5 | public boolean verify(byte[] sig) throws Exception{
int i=0;
int j=0;
byte[] tmp;
if(sig[0]==0 && sig[1]==0 && sig[2]==0){
j=((sig[i++]<<24)&0xff000000)|((sig[i++]<<16)&0x00ff0000)|
((sig[i++]<<8)&0x0000ff00)|((sig[i++])&0x000000ff);
i+=j;
j=((sig[i++]<<24)&0xff000000)|((sig[i++]<<16)&0x00... |
fc725673-f3d4-44e9-99a6-f7a51fb5d01b | 5 | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=gbk");
PrintWriter out = response.getWriter();
String user="";
user=request.getParameter("username");
user=user==null?null:new String(user.getBytes... |
aa9fdb54-886b-4682-97ea-6154cabe29d4 | 5 | public static double[] doLinearRegressionFromTo(int start,int end,double[][] args) //input int start, int end
{ //input double[1]=array of prices
double[] answer = new double[3];
int ... |
cd28dddc-a584-4ac7-9263-73911826ce78 | 6 | public void analizeQueryLog(File queryFile) throws IOException{
BufferedReader br = new BufferedReader(new FileReader(queryFile));
String line = br.readLine();
int i,singletons = 0,doubletons = 0,tripletons = 0,quadrupletons = 0,totalTerms = 0;
TermData data;
System.out.println("... |
f52f15ce-fd17-449c-a8b3-aa0bfdd49c1e | 4 | private void jButtonCheckRoomsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCheckRoomsActionPerformed
//Removes all the current elements listed in the jList.
dflRooms.removeAllElements();
//Error handling which makes sure that the arrival date is before the departure ... |
f0689391-ecd6-48b2-89f8-320091c21e48 | 6 | protected Component getUnknownMappedDataPanel(TaskObserver taskObserver) throws InterruptedException
{
taskObserver.taskProgress("Unknown Mapped Data", 0.1f);
if (Thread.currentThread().isInterrupted())
throw new InterruptedException("getUnknownMappedDataPanel() was interrupted.");
... |
22df8b1d-ae0c-41b4-a675-c696e3a2e797 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final GetSingleEventResponse other = (GetSingleEventResponse) obj;
if (this.singleEvent != other.singleEvent
&& (this.singleEvent == null || !this.singleEvent
.eq... |
b83b62cd-b89f-448e-99eb-139b1c548fd0 | 4 | public void unclaimChunk(ChunkyChunk chunkyChunk) {
ChunkyPlayerChunkUnclaimEvent event = new ChunkyPlayerChunkUnclaimEvent(this, chunkyChunk, AccessLevel.UNOWNED);
event.setCancelled(false);
Chunky.getModuleManager().callEvent(event);
if (event.isCancelled()) return;
if (!chunky... |
da736e6d-d7be-4d4b-8e91-e4edc64322f6 | 1 | public void draw(Graphics2D g2) {
g2.setTransform(new AffineTransform());
if (stage != null) {
stage.draw(g2);
} else {
g2.drawImage(loadingScreen, 0, 0, 400, 300, null);
}
} |
64add273-9094-46f8-9e45-642f71e729a5 | 1 | public static void hoist(JoeTree tree) {
if (tree.getSelectedNodes().size() != 1) {
return;
}
TextKeyListener.hoist(tree.getYoungestInSelection());
return;
} |
cd7b2516-98ac-44d5-b01a-82154e72fe21 | 4 | @Test
public void doPriorityQueue() {
init();
int count = 0;
while (true) {
Point x = prQueue.poll();
squares.add(x);
Point[] ppp = getPotentialPoints(x, getCrossPoint(x));
prQueue.add(ppp[0]);
prQueue.add(ppp[1]);
if (... |
50ae05a0-8c3d-42d4-b962-b56ac4be0bba | 4 | public boolean isNearlySymmetric(double tolerance){
boolean test = true;
if(this.numberOfRows==this.numberOfColumns){
for(int i=0; i<this.numberOfRows; i++){
for(int j=i+1; j<this.numberOfColumns; j++){
if(Math.abs(this.matrix[i][j]-this.matrix[j][i])... |
ac9e9942-71f8-43f4-9e45-5c437845d7a0 | 1 | private void db(final String s) {
if (Tree.DEBUG) {
System.out.println(s);
}
} |
4385fcb0-c8b1-4d40-9adb-3b2cd1c1638b | 8 | void getDisplayList(JPanel panel, final ContactList contactList, final CaseList caseList) {
panel.removeAll();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
activityTable.setPreferredScrollableViewportSize(panel
.getPreferredSize());
activityTable.setFillsViewportHeight(true);
JScrollPane s... |
b9d4d39b-a08d-4e2b-938d-bf14f456f1d0 | 3 | public static void main(String[] args) {
// Something to start from
Store store = new Store(); // define FD store
// define finite domain variables
IntVar In1 = new IntVar(store, "In1", 0, 1);
IntVar In2 = new IntVar(store, "In2", 0, 1);
IntVar C = new IntVar(store, "C", ... |
b9211318-2b1b-4f3c-acec-8608f5dd9a60 | 9 | private void updateStoredPieces() {
LinkedList<Integer> storedIndex = world.getStoredIndex();
int size = storedIndex.size();
if (size >= 1) {
if (nextPieceIndex[0] != storedIndex.get(0)) {
nextPieceIndex[0] = storedIndex.get(0);
storedPiece1.setImage(... |
9c5e52c1-2940-488d-849a-fe6ed5937b4e | 8 | private Line generateLine(Scanner inFile) {
Point s = null, e = null;
int thickness = 0;
Color c = null;
String current = inFile.next();
while (inFile.hasNext()
&& !(isCloseTag(current) && parseTag(current) == LegalTag.Line)) {
if (isOpenTag(current)) {
switch (parseTag(current)) {
case Start:
... |
461b7676-f069-42f3-aa5f-7358f70ac543 | 5 | @Override
public void actOnInput(int key) {
switch (key) {
// Size 2 palace
case 1:
this.activate(new AddPalaceController(2, this.game, this.view, this.gameController));
break;
// Size 4 palace
case 2:
this.activ... |
5a6ed6fe-51a5-475a-a95c-41b578525645 | 8 | public String get(int num){
if(num >= bufferlo && num <= bufferhi)
return bufferstr;
for(int i = 0; i < dict.size(); i++){
Object[] pair = dict.elementAt(i);
if(pair.length == 3){
int lo = (Integer)pair[0];
int hi = (Integer)pair[1];
if(num >= lo && num <= hi){
bufferlo = lo; bufferhi = hi... |
28f630fe-a2c3-4d0a-b596-5554bcb4df37 | 9 | private void setCIMs(IModel<Double, CTDiscreteNode> model, SufficientStatistics sStats[]) throws RuntimeException {
// Parameter calculation
NodeIndexing nodeIndexing = model.getNodeIndexing();
for( int iNode = 0; iNode < nodeIndexing.getNodesNumber(); ++iNode) {
CTDiscreteNode node = model.getNode(iNode);
... |
6155b5ec-f11e-4c16-b61e-1378b03551bc | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equalsIgnoreCase("kit") || sender.isOp() || sender.hasPermission("invserializer.kit")) {
if(args.length > 0) {
if(cmdMap.containsKey(args[0].toLowerCase())) {
cmdMap.get(args[0].toLowerCa... |
3574aed2-61ba-49ec-86af-a07ba2acc562 | 1 | private void sortExprs(final List list) {
Collections.sort(list, new Comparator() {
public int compare(final Object a, final Object b) {
if (a == b) {
return 0;
}
final int ka = ((Expr) a).key();
final int kb = ((Expr) b).key();
return ka - kb;
}
});
} |
9e63ab58-089e-4e6f-8a06-22ec1e103873 | 5 | public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} |
2840d5ab-30a8-4915-ac12-7e8458ebcc99 | 5 | public void checkserver(int num){
TC=GosLink2.TNH.get(num);
ol=OLH.get(num);
ct=CTH.get(num);
if (TC.loggedin == 1){
if (ct==3){
TC.write("");
GosLink2.dw.append("PING");
ct=0;
}else{ct++;}
if (ct >5){ct=0;}
}else{
if (ol==0){GosLink2.dw.append("Server "+num+" is offline, waiting to r... |
e5d61d98-99cf-4a61-bedf-4b6551a06755 | 7 | public static String[] splitMethodDesc(String desc)
{
//\[*L[^;]+;|\[[ZBCSIFDJ]|[ZBCSIFDJ]
int beginIndex = desc.indexOf('(');
int endIndex = desc.lastIndexOf(')');
if (((beginIndex == -1) && (endIndex != -1)) || ((beginIndex != -1) && (endIndex == -1)))
{
System.... |
3d848d7e-0017-4eca-bde8-50b7bc9d2630 | 5 | public int numDistinct(String S, String T) {
int[][] rst = new int[S.length()+1][T.length()+1];
rst[0][0] =1 ;
for (int j = 0;j<T.length();j++) rst[0][j+1]=0;
for (int i = 0;i<S.length();i++) rst[i+1][0]=1;
for (int i = 0; i< S.length();i++)
for (int j = 0 ; j <T.len... |
069f01d9-9669-4d07-b85a-6804f2580b13 | 4 | public void delete(String in)
{
if(in.equals(this.getData(0)))
{
head = head.next;
numberOfItems--;
}
else if(in.equals(this.getData(numberOfItems - 1)))
{
Nodes prev = search(numberOfItems - 2);
prev.next = null;
numberOfItems--;
}
else
{
for(int j = 0; j < numberOfItems; j++)
{
... |
12960924-44eb-4a4d-b8d6-bb001d108d99 | 4 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
HttpSession session = request.getSession(true);
String userid = request.getParameter("userid");
String pass = request.getParameter("password");
ServletContext sc = ... |
ee784893-1bbd-49b6-8240-58e091b1bf1c | 6 | public synchronized void init() {
if (inited) {
return;
}
Vector v = (Vector) library.getObject(entries, "Matrix");
if (v != null) {
matrix = getAffineTransform(v);
}
bbox = library.getRectangle(entries, "BBox");
// try and find the form's ... |
88818320-ea3c-4b35-964b-33872b59f00c | 5 | private void jButton1ActionPerformed(ActionEvent evt) {
// OK button
if (file == null){JOptionPane.showMessageDialog(null, "No file selected!"); return;}
if (jCheckBox2.isSelected()){
resetList(newlist);
}
dispose();
Tester<Kanji> test = new SimpleTest<Kanji>(newlist);
if(jComboBox... |
e4e05c51-1e54-4dee-bd46-21d12c892f6c | 9 | private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header)
throws InterruptedException
{
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) return;
StringTokenizer st = new StringTokenizer( inLine );
if ( !st.hasMoreToken... |
3d786c13-c11a-48e1-8fd1-dbe65b918b01 | 4 | @Override
public IMachine createMachine(IComputeCenter computeCenter, IImage image, IMachineDescriptor machineDescriptor)
throws InvalidObjectException, ConnectorException
{
boolean succeeded = false;
Exception createFailureRootCause = null;
Server server = null;
CloudStackClient client = ClientLocator.g... |
b0aed06d-4120-41c4-8404-b966cc383a21 | 3 | public Iterator<V> values()
{
LinkedList l = new LinkedList(); //linked list to store all the values
for (int i = 0; i < table.length; i++) //input values for each key into l
{
if (table[i] != null) //if the key has values, insert them into the list
{
Node<K,V> temp = table[i];
while (temp ... |
639cb91e-2d23-48b7-aa4f-28d234563f69 | 1 | public void save(Tile tile){
File f = new File("assets/tiles/" + tile.getName());
try {
biEx.save(tile, f);
} catch (IOException ex) {
Logger.getLogger(TileLoader.class.getName()).log(Level.SEVERE, null, ex);
}
} |
3f77b6d7-4df2-4f94-9e41-6fbdf5c557f3 | 8 | @Override
public void i3finger(MOB mob, String mobName, String mudName)
{
if(mob==null)
return;
if((!i3online())&&(!imc2online()))
return;
if((mobName==null)||(mobName.length()==0))
{
mob.tell(L("You must specify a name."));
return;
}
if(i3online())
{
final FingerRequest ck=new FingerRe... |
74817145-dc90-4fa3-a02e-b0e5acc8591c | 0 | public static void main(String [] args){
/*
Here is a little neural net to decide if you'll walk the dog today.
*/
/*Neuron walkDog = new Neuron(new StepFunction());
Neuron rain = new Neuron(new PrimaryInput("RAIN"));
Neuron snow = new Neuron(new PrimaryInput("SNOW"));
Neuron monday =... |
e3d9effa-9e69-4275-83df-8038593b4e08 | 3 | private void populateEntity() {
enemys = new ArrayList<Enemy>();
entities = new ArrayList<EntitySpecial>();
Slugger s;
Crawler s2;
Blocker s3;
Point[] points = new Point[] {};
Point[] points2 = new Point[] {};
Point[] points3 = new Point[] { new Point(165, 140) };
for (int i = 0; i < points.length; i+... |
86478eb3-8e5e-4f5d-a21c-87df2aa25f89 | 6 | @Override
public void run()
{
try
{
runProgram();
}
catch (Throwable t)
{
t.printStackTrace();
try
{
File forgeversion = new File("forgeversion.txt");
if (forgeversion.exists())
forgeversion.delete();
File buildversion = new File("buildversion.txt");
if (buildversion.exists(... |
a496e2bc-bf5b-443a-a4cc-985320b1de34 | 6 | public static Value valueFromBytes(final ByteCodeStream bytes) throws UnsupportedEncodingException {
Value value;
final byte type = bytes.getCurrentByte();
bytes.nextByte(); // consume type byte
switch (type) {
case NIL:
value = Value.getNil();
... |
411a3bd6-b4b4-4568-8eb5-164b853c50f7 | 9 | @Override
public double[] calculateFractal3DWithPeriodicity(Complex pixel) {
iterations = 0;
check = 3;
check_counter = 0;
update = 10;
update_counter = 0;
period = new Complex();
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));... |
afb00eaa-d484-49e3-b931-871be2282791 | 9 | public void findCommon(int [] A, int [] B, int [] C){
int i=0,j=0,k=0;
while(i<A.length && j<B.length && k<C.length){
if((A[i]==B[j])&& (B[j]==C[k])){
System.out.print(A[i] + " ");
i++;j++;k++;
}else if((A[i]<=B[j])&& (A[i]<=C[k])){
i++;
}else if((B[j]<=A[i])&& (B[j]<=C[k])){
j++;
}else{... |
9757369a-3222-44c4-ae4c-fdb43d2569cb | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
b91e33d8-06df-458f-b184-eba201f08667 | 9 | public void process() {
try {
VM vm = null;
Task task = null;
switch (taskType) {
case START_VM:
vm = (VM) target;
vm.setStatus(VMStatus.PoweringUp);
log.info("VM {} set to Powering Up state.", vm.getId());
... |
f0b41c9c-f747-442e-8e60-6cc983fb8105 | 2 | public void sendEvent(Event event) {
Set<Listener> listenerSet = listeners.get(event.getType());
if (listenerSet != null) {
List<Listener> eventListeners = new ArrayList<Listener>(listenerSet);
for (Listener listener : eventListeners)
listener.handleEvent(event);
}
} |
c9312cfd-ff08-455f-8848-96dc24f3f46d | 2 | public static void compAsigOperationSintax(Object[] Fieldsin) {
//Field0 = VariableComp1 = [X:|S:|C:|E:][N:|H:]NAME_op1
//Field1 = operation = ‘==’, ‘!=’, ‘>=’, ‘<=’, ‘>’ , ‘<’ , ‘$’ y ‘!!’
//Field2 = VariableComp2 = [X:|S:|C:|E:][N:|H:]NAME_op2
//Field3 = VariableHit = [X:|S:|C:|E:][N:|... |
d7d5fdc2-8330-4395-b1dd-08c6ec635b77 | 1 | public void eraseField() {
for (int i = 0; i < fieldSize; i++) {
eraseLine(i);
}
} |
ed06396f-a86f-4a86-a941-8a2a735c557a | 5 | boolean EASThasCraftedBlock(Location startLocation)
{
boolean res = false;
int validCraftBlockRows = 0; // amount of horizontal rows that have been successfully checked for crafted blocks.
// Check EAST =========================================================
// Check if there is a block to... |
7059b5aa-ebf0-499d-b6aa-0ab496bf8d24 | 5 | public static Message<?> record(final Message<?> message,
final String startTimeHeaderName,
final String endTimeHeaderName,
final String timingContextHeaderName) {
long start = 0, end = 0;
String... |
22649e5c-36e6-493a-b091-dcbfc952913a | 9 | public static <GItem> Iterator<GItem> filteredIterator(final Filter<? super GItem> filter, final Iterator<? extends GItem> iterator)
throws NullPointerException {
if (filter == null) throw new NullPointerException("filter = null");
if (iterator == null) throw new NullPointerException("iterator = null");
return ... |
fa861649-c25a-43c1-b775-c410d002f003 | 2 | public void visitSource(final String source, final String debug) {
AttributesImpl att = new AttributesImpl();
if (source != null) {
att.addAttribute("", "file", "file", "", encode(source));
}
if (debug != null) {
att.addAttribute("", "debug", "debug", "", encode(d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.