method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ff217950-8f5a-41d4-ab3d-0e47c4880012 | 9 | public ConfirmationPanel(IConfirmation conf) {
GBHelper hlpr = new GBHelper();
setLayout(new GridBagLayout());
add(new JLabel("Delivery Type"),hlpr);
add(new JLabel(null!=conf?conf.getDeliveryType():""),hlpr.nextCol());
add(new JLabel("Package Type"),hlpr.nextRow());
add(new JLabel(null!=conf?conf.getPac... |
cb21bc68-b7a3-4445-8d39-301da0139b7c | 1 | public void visit_ifle(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
068fe9bc-cd1d-4f0e-ac9b-9d96ea4fbd51 | 6 | private boolean criteriaCheck1( Ptg[] curRow, DB db )
{
boolean bColOK = false;
boolean bRowOK = true;
int nrows = getNRows();
int ncols = getNCols();
int ndbrows = db.getNRows();
String cl = getCol( 0 );
int j = db.findCol( cl );
if( j >= 0 )
{
bColOK = false; // need one bColOK= true for it ... |
1b5efab9-6d67-4691-8a0c-e071824b31ef | 8 | @Override
public void run() {
callback.log("Connection accepted");
try {
out = new ObjectOutputStream(socket.getOutputStream());
in = new ObjectInputStream(socket.getInputStream());
while(true){
Envelope m = null;
//read in a evenlope.
m = (Envelope)in.readObject();
if(m == null){
br... |
13781270-0754-41aa-8a7d-f2baac4c11e5 | 6 | @Override
protected void writeClassfiedTable(String classification2) {
// header
writeTableHeaderRow();
nextLine();
// body
for (String categoryName : categoryMap.keySet()) {
Category category = categoryMap.get(categoryName);
if (!AggregationGroup.MASSOGI.getKana().equals(categoryName)
&& !Aggrega... |
da854ea3-7c36-4b5c-99ad-085e166497ca | 1 | public void visit_if_icmpge(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_if_icmplt);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_if_icmpge);
addBranc... |
a1119fe2-6264-4069-bfa2-2816dd38475e | 9 | public static double findMinDistance(Instances inst, int attrIndex) {
double min = Double.MAX_VALUE;
int numInst = inst.numInstances();
double diff;
if (numInst < 2) return min;
int begin = -1;
Instance instance = null;
do {
begin++;
if (begin < numInst)
{ instance = inst.inst... |
792d724e-0e4c-4e37-b14c-2d0dd7672455 | 7 | public double[][] ValueIteration()
{
int numIteration = 25;
int iter = 0;
double[][] allUtils = new double[this.game.States.length][this.game.States[0].length];
while(iter < numIteration)
{
//Update the utility of each state according to Bellman Equation:
for(int i = 0; i < this.game.States.length; ... |
b5e25d68-1cca-40fa-8cf9-3697eca93595 | 5 | public void move(int dir) {
if (dir == def.Frame.LEFT) {
dx = Frame.SPEED;
dy = 0;
}
if (dir == def.Frame.RIGHT) {
dx = -Frame.SPEED;
dy = 0;
}
if (dir == def.Frame.UP) {
dy = Frame.SPEED;
dx = 0;
}
if (dir == def.Frame.DOWN) {
dy = -Frame.SPEED;
dx = 0;
}
if (dir == def.Frame.... |
f46faedb-e275-427d-8fcd-68a5afad72bd | 2 | public void update(long delta) {
hitTimeLeft -= delta;
if (active) {
InputHandler input = InputHandler.getInstance();
if (input.isPressed()) {
checkMouse(input.getClickPoint());
}
}
} |
465a5dad-f185-4239-9f20-1fadf1f4e7b6 | 1 | public CmdLineOption(String description, String argumentLabel, String... names) {
mNames = new String[names.length];
mDescription = description;
mArgumentLabel = argumentLabel;
for (int i = 0; i < names.length; i++) {
mNames[i] = names[i].trim().toLowerCase();
}
} |
fb0dde91-eb53-4e6e-bbce-40595443778e | 7 | private ArrayList<SpeciationNeuralNetwork> merge(ArrayList<SpeciationNeuralNetwork> one,ArrayList<SpeciationNeuralNetwork> two){
ArrayList<SpeciationNeuralNetwork> merged=new ArrayList<>();
while(!one.isEmpty()&&!two.isEmpty()){
if(one.get(0).getFitness()>two.get(0).getFitness())
... |
54e80963-fe07-494b-b7a2-1f1c06b07b4e | 0 | public void setType(String type) {
this.type = type;
} |
961a65d8-5c5c-416b-ab8a-edbd7f364a21 | 8 | public void mostrarVentanaEmergente(int caso){
switch(caso){
case 0:
JOptionPane.showMessageDialog(this, "Bienvenido, "+usuario);
break;
case 1:
JOptionPane.showMessageDialog(this, "El nuevo usuario se ha creado satisfactoriamente");
... |
55bed77a-831c-40ae-a049-c2f4edb033e5 | 0 | public final double valueAt(int row, int column) {
return entry[row][column];
} |
787524c0-5078-408f-9de8-1df006924fe6 | 5 | @Override
public Coordinate determineMove(Board board, Mark mark) {
Coordinate move;
LinkedList<Coordinate> allowedMoves = board.getAllowedFields(mark);
int currentFields = board.countFields(mark);
int bestFields = currentFields;
Coordinate bestMove = null;
long endTime = System.currentTimeMillis() + tim... |
646a5cb3-0f7a-4c18-8036-1300f080d718 | 2 | public LocalMethod(int modifiers, Class type, java.lang.String name,
Class[] paramTypes,Class[] exceptions) {
super(modifiers,type,name,null);
if (paramTypes!=null)
this.paramTypes=paramTypes;
else
this.paramTypes=new Class[0];
if (exceptions!=null)
this.exception... |
70ee9021-e329-4a5e-89f3-961d3aee1266 | 3 | @Override
@SuppressWarnings("unchecked")
public GeoJsonObject deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
JsonObject jsonObject = json.getAsJsonObject();
String type = jsonObject.get("type").getAsString();
if (GeoJson.isUsingLowerCaseTypes && low... |
698682be-4f6d-43a6-89bf-fced3c3d3697 | 4 | protected static ClassLoader directGetContextClassLoader()
throws LogConfigurationException
{
ClassLoader classLoader = null;
try {
// Are we running on a JDK 1.2 or later system?
Method method = Thread.class.getMethod("getContextClassLoader",
(C... |
41384648-71b9-4388-9db6-4e49912fef69 | 9 | @SuppressWarnings("unchecked")
void run(){
Scanner sc = new Scanner(System.in);
n = sc.nextInt(); m = sc.nextInt();
int[] r = new int[n];
for(int i=0;i<n;i++)r[i]=sc.nextInt();
list = new List[m];
e = new boolean[m][n];
for(int i=0;i<m;i++){
list[i] = new ArrayList<R>();
int k = sc.nextInt();
do... |
d473a338-9a92-484f-9367-cebabab8cb75 | 3 | public Map<RedisBigTableKey, byte[]> getByFamily(byte[] table, byte[] row, byte[] columnFamily) throws RedisForemanException
{
Map<RedisBigTableKey, byte[]> all = this.getByRow(table, row);
boolean cfHasWildCard = Utils.hasWildCard(columnFamily);
String keyIsLike = join(Utils.RECORD_SEPARATOR, row, columnFamily)... |
66297be4-3067-4192-9bf7-1dee1ff6c944 | 5 | private int pullFromInputBuffer() throws IOException {
while (true) {
this.inputLock.writeLock().lock();
try {
this.ensureOpen();
if (!this.reachedEnd && this.inputBuffer.length() == this.inputBufferPos) {
this.reachedEnd = true;
return -1;
} else if (this.inputBufferPos < this.inputBuffer... |
71a34591-caa3-481d-8018-7bda6b662e5d | 4 | @Override
public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) {
ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>();
DiagonalMove toTopLeft = new DiagonalMove();
DiagonalMove toTopRight = new DiagonalMove();
DiagonalMove t... |
759a7072-ff7a-42ef-a215-7fdd10a2c4f0 | 7 | public int getNumberOfObjekt(String objektName) {
LinkedList<OceanObject> oceanObjectsCount = ocean.getOceanObjects();
if (oceanObjectsCount.isEmpty()){
return 1;
}
else{
Iterator<OceanObject> iter = oceanObjectsCount.iterator();
int i = 1;
while(iter.hasNext()){
String[] splitResult = iter.ne... |
f3aa0ff4-e77a-4942-a36d-b18d5ddff455 | 6 | public static int getRowInColWithCollision(char[][] array, String word, int c) {
for(int i=0;i<array.length-word.length();i++) {
// start from all possible places
int arrayPointer = i;
int wordPointer = 0;
while(wordPointer < word.length() && arrayPointer < array.... |
23736d2d-e6e1-490b-b0e2-47136a7a11a8 | 7 | private static boolean doAction(String action, String root, String path, String type, String key, String data)
{
StringBuilder sb = new StringBuilder("");
String[] query = null;
Map<String, List<String>> results = null;
try {
sb.append("REG " + action + " " + root + path + " ");
if( key == null ) ... |
f0511ec4-4bdd-400d-b370-e9e9f0ac9324 | 9 | private static String processServerDoGetResponseFromXMLToString(String s) throws Exception
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// factory.setIgnoringElementContentWhitespace(true);
// factory.setValidating(true);
DocumentBuilder builder = fa... |
ee851a58-a9a7-4b89-9513-56042db305d3 | 7 | public static void main(String[] args) {
Stack[] stacks = {new Stack(ARRAY), new Stack(LIST), new StackFIFO(), new StackHanoi()};
int positionOfStackHanoi = findLastInstanceOfStackHanoi(stacks);
for (int i = 1; i < MAX_LOOPS; ++i) {
for (int j = 0; j < stacks.length - 1; ++j) {
... |
515336d7-8b81-4efc-9851-90ef16833d53 | 3 | public String doGetRequest (String operation) {
try {
URL url = new URL(dexmaApiURL+operation);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
conn.addRequestProperty("x-d... |
68962d6e-f608-41f2-ab92-5bc30a1f34ac | 9 | public boolean heteroPari() {
if (avecIsSet == false && puolisoIsSet == false) {
return false;
}
if (avecIsSet) {
if (isMies()) {
if (getAvec().isMies()) {
return false;
} else {
return true;
... |
4869ed24-0953-4689-8b5e-5ed9463e4a7f | 2 | public void addProduction(Production production) {
if (myProductions.size() == 0
&& !ProductionChecker.isRestrictedOnLHS(production))
throw new IllegalArgumentException(
"The first production must be restricted.");
super.addProduction(production);
} |
03f67e04-c457-49c8-99ac-dab260c732dd | 1 | private void checkerr() {
if (error != null) {
System.out.printf("Delayed error in resource %s (ver %d), from %s\n", name, ver, source);
error.printStackTrace();
}
// throw (new RuntimeException("Delayed error in resource " + name
// + " (v" + ver + "), from " + source, error));//
} |
06d569b0-d207-4f2f-a794-dc3a080b1c44 | 3 | public JSONObject accumulate(
String key,
Object value
) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key, value instanceof JSONArray
? new JSONArray().put(value)
... |
d11c8fa4-11d0-49c9-8942-7b6fd43d2b82 | 0 | public void setPcaGenerico(Integer pcaGenerico) {
this.pcaGenerico = pcaGenerico;
} |
1693bc04-3c04-47ef-9f7f-b999789e915a | 4 | public String parseToString(String file) {
String result = "";
String sCurrentLine;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader((file)));
while ((sCurrentLine = br.readLine()) != null) {
result = result + sCurrentLine;... |
e1c4436c-0319-4a8f-86b8-daf579ebd34c | 3 | @Test
public void WhenUpdatingAndLocalhostIncreasedHisPath_ExpectLevelsAdded() throws UnknownHostException {
int refMax = Integer.MAX_VALUE;
RoutingTable localRT = new RoutingTable();
String localhostPath = "0000";
localhost_.setHostPath(localhostPath);
localRT.setLocalhost(... |
def2474e-159d-47c4-8156-7aa2aa714d99 | 1 | private void fillTextFields(){
MainFrame mainFrame = MainFrame.getInstance();
words = mainFrame.getList();
int index = mainFrame.getIndex();
if (words != null) {
Word currentWord = words.get(index);
noteEditorFrame.setOldValue(currentWord.getEWord());
... |
172b6760-0e6b-4d69-a365-9b1f3b7255c9 | 3 | public void deleteTables() throws RedisForemanException
{
Set<byte[]> keys = instance.hkeys(ForemanConstants.TableIdentifier.TABLE.getId());
for (byte[] key : keys)
{
Set<byte[]> subkeys = instance.hkeys(key);
for (byte[] subkey : subkeys)
{
instance.hdel(key, subkey);
}
boolean isSystemTable ... |
e3a4f02e-a748-4d48-954f-c12e889c700e | 2 | public Chessboard ()
{
fields = new Field[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]; char row = 0;
byte column = 0;
for (int r = 0; r < NUMBER_OF_ROWS; r++)
{
row = (char) (FIRST_ROW + r);
column = FIRST_COLUMN;
for (int c = 0; c < NUMBER_OF_COLUMNS; c++)
{
fields[r][c] = new Field (row, column);... |
7f1a2cbe-259d-4b24-9497-40ef79b61ed5 | 4 | public static <T> int getLowerBoundToKey(T[] a, int from, int to, T value) {
int low = from;
int high = to;
int lowerBound = low;
while (low <= high) {
int mid = (low + high) >>> 1;
if (mid == high) {
return mid;
}
Comparab... |
8a635d9f-9a8e-44ea-a898-8dcefaf950d8 | 4 | private void actionFeu(Model iModel, AgentEnvironnement iAgentEnv, Integer iX, Integer iY)
{
Int2D aLocation = new Int2D(iX, iY);
Bag aAgents = iModel.getYard().getObjectsAtLocation(aLocation);
if(aAgents != null && aAgents.size()==1)
{
AgentEnvironnement aAgentEnv = (AgentEnvironnement)aAgents.get(0);
i... |
f82362ee-ac7a-4f49-a34b-3b0a12ae6e42 | 9 | private static void sourceChar(char c, StringBuilder buf) {
switch (c) {
case '\b': buf.append("\\b"); return;
case '\t': buf.append("\\t"); return;
case '\n': buf.append("\\n"); return;
case '\f': buf.append("\\f"); return;
case '\r': buf.append("... |
06449bf3-42d7-48e6-85e3-36d9908e9b43 | 9 | public static void findWay(int[][] maze, Pair start, Pair end) {
// Min Heap holding
PriorityQueue<Pw> heap = new PriorityQueue<>(maze.length * maze.length , new Comparator<Pw>() {
@Override
public int compare(Pw o1, Pw o2) {
return Integer.compare(o1.weight, o2.w... |
401b0b84-2959-41ca-bb90-8948ab2540fe | 3 | protected void doAverageLine(byte[] curLine, byte[] prevLine) {
// get the number of bytes per sample
int sub = (int) Math.ceil((getBitsPerComponent() * getColors()) / 8.0);
for (int i = 0; i < curLine.length; i++) {
int raw = 0;
int prior = 0;
... |
3c5dbf37-2848-4208-939f-21786f5888d5 | 4 | public Type getHint() {
if (ifaces.length == 0 || (clazz == null && ifaces.length == 1))
return this;
if (clazz != null)
return Type.tClass(clazz.getName());
else
return Type.tClass(ifaces[0].getName());
} |
a7742fb7-7a78-4eec-81a2-77604554426a | 1 | @Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("<HTML><HEAD><TITLE>Administrar Diccionario</TITLE></HEAD>");
out.println("<BODY B... |
e2af3c0a-bdf1-4292-aaea-d74b24abd990 | 7 | public void createNewTask(JTable tableAllTask, JList listUsersOnTask, JCheckBox checkBoxSub, JTextField textFieldTaskName, JComboBox comboBoxType, JComboBox comboBoxStatus,
JTextField textFieldCustomer, JComboBox comboBoxTaskLeader, JDateChooser dateChooserExpectedStart, JDateChooser dateChooserExpectedEnd,... |
605b94fe-6745-4a58-b5a8-2756a57f96b0 | 4 | int getWidth(int index) {
int count = 1;
for (int i = index - 1; i > -1; i--) {
if (height[i] >= height[index])
count++;
else
break;
}
for (int i = index + 1; i < height.length; i++) {
if (height[i] >= height[index])
... |
c607450b-c4e5-4f6d-b906-f303324e8c33 | 0 | @Column(name = "PRP_POS_ID")
@Id
public Integer getPrpPosId() {
return prpPosId;
} |
b2d6b6f4-2889-4815-923a-2372fe87f21a | 5 | public boolean isCurrentOperatingSystem() { if ((this.name != null) && (this.name != OperatingSystem.getCurrentPlatform())) return false;
if (this.version != null)
try {
Pattern pattern = Pattern.compile(this.version);
Matcher matcher = pattern.matcher(System.getProperty("os.version")... |
c21f0306-2365-497d-9340-b882d9995125 | 5 | public static void createViewerInFrame(String[] cardsID, Zone zone,
Dimension gameSize, String info) {
final JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
mostRecentCardViewer = new CardViewer(new InSearcher... |
07fe8ecd-2d05-4383-9daf-75a1fada4746 | 2 | @Test
public void isKeyChangedAndPlacedInCorrectWay() {
Goo g1 = new Goo(114, "lu-" + 114);
Goo g2 = new Goo(13, "lu-" + 13);
Goo g3 = new Goo(600, "lu-" + 600);
Goo g4 = new Goo(9, "lu-" + 9);
Goo g5 = new Goo(7, "lu-" + 7);
mh.insert(114, new Double(114));
... |
75c91b2c-6b41-49d3-8d00-30dde8a2a405 | 2 | @Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
String line = value.toString();
for (String word : line.split("\\W+")) {
if (word.length() > 0) {
text.set(word);
context.write(text, intWritable);
}
}
} |
6b2e0fe1-4476-4548-8e41-b58d96e0a08f | 5 | public static CustomButton doDescriptionSearchButton(
final JTextArea searchWords) {
final CustomButton a = new CustomButton("search");
// final ArrayList<String> tickers = new ArrayList<String>();
a.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JF... |
17c51110-c6bf-4c77-8553-08a5565ea21a | 4 | @Override
boolean transcriptChange() {
//ChangeEffect change = new ChangeEffect(seqChange);
//a star followed by distance to cds end
//coding start
if (utr3prime.intersects(seqChange)) {
Integer relativePosSt = (transcript.isStrandPlus() ? seqChange.getStart() - transcri... |
a1770389-6f20-4301-98c9-6857a63ab323 | 5 | @Test
public void testGenerateOnlyDistributionsWithNaturesFromRestrictions() {
Set<Nature> natures = new HashSet<>();
natures.add(neutralNature);
natures.add(Nature.Possibility.INC_DEF.getNature());
natures.add(Nature.Possibility.INC_SPDEF.getNature());
when(restrictionsModel.getAllowedNatures()).thenReturn... |
034cd509-b099-47e7-b839-8bf45be08c58 | 8 | public static ArrayList<Integer> spiralOrderHelper(int[][] matrix, int x,
int y, int[][] matrixHelper) {
ArrayList<Integer> newList = new ArrayList<Integer>();
// if(x > matrix[0].length/2 || y> matrix.length/2 ){
// return newList;
// }
// top
for (int i = x; i < matrix[0].length - x; i++) {
if (matr... |
9273c86c-0ab0-46da-8b16-1793088a92e8 | 4 | @Override
public void validarSemantica() {
if(InfSemantica.getInstancia().tablaFunciones.containsKey(nombre)&&InfSemantica.getInstancia().tablaGlobal.containsKey(nombre)
&&TablaIds.getInstancia().getVariableNumber(nombre)==-1 )
{
try {
throw new Exception... |
f4fc546c-1079-4654-b281-afe6f6c9675a | 3 | public static void sendPlayersIgnores(BSPlayer p, Server s){
if(p.hasIgnores()){
String ignores = "";
for(String str:p.getIgnores()){
ignores+=str+"%";
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("SendPlayersIgnores");
... |
f98e27c5-ad41-4506-8537-8794611b73f1 | 5 | private void showStatementInfo(TreePath treePath) {
if(treePath != null) {
TreeNode selectedNode = (TreeNode) treePath.getLastPathComponent();
/* Get statement from the node which has been selected and show a
* relevent dialog */
if(selectedNode ins... |
d0316a33-2d08-4b00-9c67-bdaca10d94d0 | 6 | public void assign(String oid)
{
if(unassigned.contains(oid))
{
unassigned.remove(oid);
Objective o = q.getObjective(oid);
ObjectiveType type = o.getType();
objprog.put(oid, type.createProgress(type.getData(o.getTarget())));
if(SkyQuest.isOnServer() && o.isVisible())
{
Player p = Bukkit.getSe... |
08ca65fe-04fa-4a93-8226-175bb190d7b0 | 7 | public static mxICanvas drawCells(mxGraph graph, Object[] cells,
double scale, mxRectangle clip, CanvasFactory factory)
{
mxICanvas canvas = null;
if (cells == null)
{
cells = new Object[] { graph.getModel().getRoot() };
}
// Gets the current state of the view
mxGraphView view = graph.getView();
... |
8b612d39-938b-4e5e-af97-e473c99dc92d | 4 | private int displayActiveQuizzes() {
int choice = 0;
System.out.println("Select quiz: ");
try {
List<Quiz> availableQuizzes = quizService.getListAvailableQuizzes();
if (availableQuizzes.isEmpty()) {
System.out.println(UserDialog.NO_QUIZZES_AVAILABLE);
... |
d05781cd-46d2-4e77-847f-068766a3c84e | 4 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) return Tile.tileVoid;
return Tile.get(pixels[x + y * width]);
} |
16d7631f-a2c8-455f-b3db-9ce214963a70 | 9 | public static void listChildren( Element current, int depth, Vector boneRecs )
{
List children = current.getChildren();
Iterator iterator = children.iterator();
BoneRec bone = new BoneRec();
// get next file name
if ( current.getName().equals( "uniqueid" ) )
... |
e5ac74d6-3551-4d8f-b974-dcc12fba1823 | 8 | public static void main(String[] args) {
Path path = FileSystems.getDefault().getPath("D:\\daily\\BR_BRAND_CRM_zfb_20111215");
try (WatchService watchService = FileSystems.getDefault().newWatchService()) {
WatchKey watchKey = path.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY,... |
f2bbff63-0c97-41a7-99fa-1eae90571746 | 3 | public static Weapon getSemiRandomWeapon(long time){
List<Level> levelList = new ArrayList<Level>();
if(time < 50000){
levelList.add(WeaponFactory.Level.RUSTY);
levelList.add(WeaponFactory.Level.NORMAL);
levelList.add(WeaponFactory.Level.LARGE);
}else if(time < 100000){
levelList.add(WeaponFact... |
b6452912-e5f9-4dad-aab4-41aaa5c15ea5 | 3 | public void startGame() {
GameTurn gTurn = new GameTurn();
String playerCountS = "";
while (playerCount <= 0) {
playerCountS = (String)JOptionPane.showInputDialog(
null,
"Enter the number of players",
"",
... |
a9ebdc2b-7b1d-4d63-9ddd-6ebbe8f11f15 | 0 | public DeexpressionifyTransitionTool(AutomatonPane view,
AutomatonDrawer drawer, REToFSAController controller) {
super(view, drawer);
this.controller = controller;
} |
02b5d9d5-b59b-4e04-875b-be09e8153e5b | 3 | public Object unify(Object o, int hash, Comparator comparator) {
// /#ifdef JDK12
cleanUp();
// /#endif
int slot = Math.abs(hash % buckets.length);
for (Bucket b = buckets[slot]; b != null; b = b.next) {
Object old = b.get();
if (old != null && comparator.compare(o, old) == 0)
return old;
}
put... |
c60bd55a-e687-4d42-825a-3a7c716ba021 | 4 | public int[] ordenarDesc(int[] arreglo) {
//iteramos sobre los elementos del arreglo
for (int i = 0 ; i < arreglo.length - 1 ; i++) {
int max = i;
//buscamos el mayor número
for (int j = i + 1 ; j < arreglo.length ; j++) {
if (arreglo[j] > arreglo[max]... |
c35cc8a3-5961-4c30-8cc9-464a24881a18 | 7 | @Override
public void doAction (String o)
{
Global.notewindow(this, "editp");
if (Global.resourceString("Set").equals(o))
{
C.Name = Name.getText();
C.Server = Server.getText();
C.State = State.getSelectedIndex();
try
{
C.Port = Integer.parseInt(Port.getText());
}
catch (NumberFormatExc... |
bf792a62-0a96-454c-bbd9-c21eac43c873 | 3 | public double dameGananciaMedia(Nodo n) {
int ganancia = 0;
int num = 0;
for (Nodo ady : memoria.getAdjacents(n)) {
if (!ady.isEstimacion()) {
ganancia += ady.ganancia;
num++;
}
}
if (num != 0) {
return ganancia / num;
}
return 0;
} |
377754a2-55a0-4242-9eff-c8950f543533 | 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... |
59fcf15a-9f8d-4645-860b-781f0f75837f | 2 | public boolean matchSymbolbySymbolRef(String symbol, Symbol symbolRef) throws Exception{
if(symbolRef == null)
return false;
if(SymbolComplexValueHelper.isComplex(symbolRef)){
return processComplexSymbolValue(symbol, symbolRef.getValue());
}else{
retu... |
cc25b3b0-f440-4873-b254-baeeb186e730 | 6 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final FunctionMap<?, ?> other = (FunctionMap<?, ?>) obj;
return Objects.equals(this.innerMap, other.getInnerMap... |
9f7fd717-2a32-466b-a263-85c528adfdde | 7 | @Override
public void actionPerformed(ActionEvent e) {
panelStat.getLabelError().setText("");
String typePerso = (String) panelStat.getTypesPersoComboBox().getSelectedItem();
String nomPerso = panelStat.getNomPersonnageTextField().getText();
if(nomPerso.equals("")){
pane... |
a27dffe2-8895-46db-ad77-5cfec6c2883f | 3 | public String getFullAlias() {
if (parent != null) {
String parentAlias = parent.getFullAlias();
String alias = getAlias();
if (alias.length() == 0)
return parentAlias;
else if (parentAlias.length() == 0)
return alias;
else
return parentAlias + "." + alias;
}
return "";
} |
0b3eecfa-3680-4d45-98a0-5fcafa985708 | 6 | protected void installListeners() {
super.installListeners();
propertyChangeListener = new PropertyChangeHandler();
comboBox.addPropertyChangeListener(propertyChangeListener);
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
... |
65ab381d-74ae-4081-b1a4-9312babae987 | 3 | private void processEntry(
final ZipInputStream zis,
final ZipEntry ze,
final ContentHandlerFactory handlerFactory)
{
ContentHandler handler = handlerFactory.createContentHandler();
try {
// if (CODE2ASM.equals(command)) { // read bytecode and process it
... |
2a085552-1972-4d48-8821-ccd6f8d2f49f | 5 | @Override
protected Object decode(ChannelHandlerContext context, Channel channel, ChannelBuffer buffer) throws Exception {
if(context.getPipeline().get(HandshakeDecoder.class) != null) {
context.getPipeline().remove(this);
}
byte serviceReq = (byte) (buffer.readByte() & 0xFF);
ChannelBuffer msg = ChannelBuf... |
aeb31fcc-217f-4653-adad-da58371faae0 | 7 | private boolean canQueenFight(Cell fighterCell, Cell targetCell) {
if (targetCell == null || !targetCell.isEmpty()) {
return false;
}
StepDirection direction = chessBoardModel.getDirection(fighterCell, targetCell);
Cell victimCell = searchNextNonEmpty(fighterCell, direction... |
2280610b-17ff-4cd2-90f5-042cdac41b9c | 4 | public void setName(String name) throws Exception {
if (name == null)
throw new Exception("Name should not be null!");
String s = name.replaceAll("\\W", "");
if (!s.equals(name))
throw new Exception("name cannot contain non-word chars");
if (name.length() < 1)
throw new Exception("name must contain at ... |
e51517e5-0cff-47c9-b8a3-61ae9dddc270 | 9 | public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int w = scn.nextInt();
int h = scn.nextInt();
int n = scn.nextInt();
while (w != 0 || h != 0 || n != 0) {
boolean board[][] = new boolean[w][h];
int offCount = h * w;
... |
e1be7850-9022-4c96-a6da-c53aca148dcf | 5 | public List<Interest> readCRMInterestsCSV(File csvFile) {
BufferedReader br = null;
String line = "";
List<Interest> interests = new ArrayList<Interest>();
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
// use comma as separator
String[] unpa... |
cb2ef271-874b-4835-acdf-2aaf2fc46c0c | 1 | public static String eliminarPuntosString(String s){
if (!s.isEmpty()){
s = s.replace('.', ' ');
s = s.replace(" ", "");
}
return s.trim();
} |
07fe2461-9fa8-4fda-9946-0ac915f5dc35 | 7 | public Imagem transform(Imagem imagem, boolean fill) {
Imagem newImagem = new Imagem(imagem.getWidth(), imagem.getHeight(), fill);
int z = 1;
int halfX = imagem.getWidth() / 2;
int halfY = imagem.getHeight() / 2;
for (int x = -halfX; x < halfX; x++) {
... |
d1cb426b-33ec-4cc6-88b0-1ffb32c0609f | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
Room R=CMLib.map().roomLocation(target);
if(R==null)
R=mob.location();
if(!super.invoke(mob,comm... |
e979fee3-91ae-4ffa-94d0-c948e85e5245 | 6 | public ParametricPolarEquation(String equ_theta, String equ_r, double tstart, double tend, double dt){
this.tstart = tstart;
this.tend = tend;
this.dt = dt;
equtheta = new Equation(equ_theta);
equr = new Equation(equ_r);
Vector<Variable> variables = equtheta.getVariables();
if(variables.size()==0){
... |
8eeae62c-bff4-44e5-bb04-6b53163415cf | 5 | public double getRealProbability(int card, boolean higher){
//We haven't dealt yet, so this is just probabilities for the entire deck
if (draw_count == 0)
return (higher ? cards - card : card - 1) / (double) (cards-1);
//Otherwise, get real probability
int total = draw_count;
for (int i=0; i<draw_count; i+... |
14a1e110-4da0-4a04-9530-0fa37c33ce41 | 6 | public String binarySubLInteractorAtHostPort(String base64SubLRequest, String hostname, String port) {
int timeoutCount = 0;
Base64 base64 = new Base64();
while (true) {
try {
CycAccess cycAccess = establishAndVerifyCycAccess(hostname, port);
CycList subLRequest = (CycList) bas... |
1eb783c6-d3d4-4419-88f9-64672bf0907d | 6 | private final void cleanOldFiles() {
info("Cleaning up old files from previous versions...");
File[] oldFileList = {new File(dataFolder, "pluginlist.txt"), new File("pnodes.txt"),
new File("pnodesfull.txt"), new File("EssentialsPnodes.txt"), new File("EssentialsPnodesfull.txt"),
new File("update/GetPerms.j... |
136ee1e3-d04a-4d39-86a2-1baa2f549907 | 3 | public AngleDR Preces(String sys, double ep0, double ep1, AngleDR d) {
double pm[][], v1[], v2[];
TRACE("Preces");
/* Validate sys */
boolean fk4 = sys.toUpperCase().equals("FK4");
boolean fk5 = sys.toUpperCase().equals("FK5");
if (fk4 || fk5) {
/* Generate ... |
faa9c0fc-3a5e-4118-964f-2b7e14f369fe | 5 | private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
// TODO add your handling code here:
String s = (String) listaElevi.getSelectedValue();
liceu.Administrator admin = new liceu.Administrator();
admin.delUser(s);
... |
ec72174d-4207-49e8-b233-cf298a1a6392 | 2 | private void findPorts() {
portComboBox.addItem("-");
Enumeration portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement();
String name = portId.getName();
... |
6c63f983-b57e-4431-a755-8ccd190988a4 | 5 | public GUI() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 364, 197);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLa... |
a7031116-83c7-4337-b61b-1437e4cb8cc9 | 8 | private static String recipeEqualsTest() {
// create some recipes to test...
String[] ingredients = new String[]{"ingredient1", "ingredient2"};
String[] ingredients2 = new String[]{"ingredient2", "ingredient2"};
String[] category = new String[]{"Drinks"};
String[] direction = new... |
e1a257b3-9d45-43e9-9eae-f6e4358eb8dd | 2 | final void method1ms() {
long timeMillis = System.currentTimeMillis();
while (true) {
if (System.currentTimeMillis() > timeMillis + 1)
return;
}
} |
efc38c11-271f-4c8a-84b5-a4e1d283470a | 6 | public synchronized boolean removeIRCEventListener(IRCEventListener l) {
if (l == null)
return false;
int index = -1;
for (int i = 0; i < listeners.length; i++)
if (listeners[i].equals(l)) {
index = i;
break;
}
if (index == -1)
return false;
listeners[index] = null;
int len = listeners.l... |
ebd73361-94ef-42ed-9b83-3b739303c47b | 3 | @Override
public void refreshList() {
List<Entity> hudComponentList = entityManager.getEntitiesContaining(HUDableComponent.class);
// Check if there are indeed any entities that want to be shown on the
// HUD
if (hudComponentList.size() > 0) {
// Get the Entity that wants to be tracked to the HUD. HUD supp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.