method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
be88541d-d374-4df8-a7b5-46c5bef37a60 | 0 | public void setCar(Car car) {
this.car = car;
} |
204f9d04-b7af-4126-96a7-98b6cc91570b | 3 | @Override
public void open()
{
Uiswt uiswt = Uiswt.getInstance();
uiswt.openMessageBox("开始营业");
MessageQueue.getInstance().addMessage("开始营业了");
if(Storage.getInstance().getRevenue() < 10000.0)
{
restaurant.setState(restaurant.getBadstate());
}else if(Storage.getInstance().getRevenue() >= 10000.0 && St... |
2d237e7a-7fa1-431c-aa98-1ad4bf5ef8ad | 8 | public DBType getMaxKey(TypeMetadata meta) {
readLock();
try {
if (maxKey == null) {
List<Record> list = getData();
if (list == null || list.size() == 0) {
maxKey = null;
return null;
} else {
Set<Object> pinnedBlocks = new HashSet<Object>();
try {
Record record = list.get(l... |
908995bc-5057-4506-abc9-dc077c9073b9 | 6 | private HashSet<Token> activeTokensAt(int index) {
HashSet<Token> result = new HashSet<>();
index = Math.min(index, this.tokens.size());
loop: for (int i = 0; i < index; ++i) {
Token token = this.tokens.get(i);
if (token.isText())
continue;
... |
95fdf61b-ba0a-4323-88e9-b74a6dbac56a | 7 | public BiMap<String, String> getItemNumberDescHash() {
if(this.itemNumberDescHash == null) {
this.setItemNumberDescHash(HashBiMap.create());
}
List<String> itemNumbers = null;
try {
itemNumbers = FileUtils.readLines(FileUtils.getFile(itemListFile));
} catch (IOException e) {
// TODO Auto-gen... |
967ba40b-14e5-49b0-9251-44712e85c463 | 1 | public Constant newField(final String owner, final String name,
final String desc) {
key3.set('G', owner, name, desc);
Constant result = get(key3);
if (result == null) {
newClass(owner);
newNameType(name, desc);
result = new Constant(key3);
put(result);
}
return result;
} |
56e6899e-0bf2-4ddf-b0b4-c6bf174252e5 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((orderProductId == null) ? 0 : orderProductId.hashCode());
result = prime * result
+ ((productId == null) ? 0 : productId.hashCode());
res... |
b3353303-7708-428b-8450-cce5e64c7718 | 8 | private void initializeAndRemoveLowerBounds(
HashMap<String, ArrayList<Route>> flightMap) {
HashMap<String, Integer> demandChange = new HashMap<String, Integer>();
for (String key : flightMap.keySet()) {
ArrayList<Route> routes = flightMap.get(key);
Vertex v;
LinkedList<Edge> list = new LinkedList<... |
fced5bf0-17a2-4674-a305-5e206446f17e | 0 | public int getId()
{
return id;
} |
f4613aa7-895a-4f46-9bbf-5b02e71459e8 | 4 | protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
@SuppressWarnings("unchecked")
... |
62a70b6b-c9ce-4a4d-82bb-5c72a66372e8 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int UserId = Main.DecodeInt();
if(!Main.Data.Friends.contains(UserId))
{
Environment.InitPacket(261, Main.ClientMessage);
Environment.Append(6, Main.ClientMessage);
Environment.Appen... |
5d22dcc4-4f69-429e-8c7d-02f435771b53 | 0 | public void checkProduction(Production production) {
/*
* if (production.getLHS().length() == 0) { throw new
* IllegalArgumentException ("The left hand side cannot be empty."); }
*/
} |
7a7ae8d2-11d4-4387-8416-b17ad542cf5a | 6 | public void parseFile(File file) throws IOException {
// InputSource inputSource = null;
if (!file.exists() || !file.isFile()) {
throw new IOException("Given corpus file does not exist or is no file!");
}
try {
InputSource inputSource = new InputSource(new BufferedReader(new FileReader(file)));
XMLRe... |
617214c3-b838-4ff8-9fdd-07a93cc2e511 | 5 | public boolean match(Sim_event ev) {
if (ev == null) {
return false;
}
boolean result = false;
try {
// find an event with a matching tag first
if ( tag == ev.get_tag() ) {
Object obj = ev.get_data();
// if the event's... |
cffc5d4a-40cd-4935-bc8d-907932cfc242 | 7 | private int checkIndex(final ByteBuffer buf) {
try {
outputLog("Type = " + new String(buf.array(), 0, 4, "ASCII"));
outputLog("Version = " + buf.getShort(0x18) + "." + buf.getShort(0x1A));
outputLog("ID = 0x" + Long.toHexString(buf.getLong(0x1C)));
int offset = buf.getInt(0x5C) + 0x60;
if(buf.li... |
106593f5-db08-40d1-a7d2-c3fd912e6048 | 5 | public int heuristic(Node n)
{
int total = 0;
for(int i = 1; i <= 3; i++)
{
int current = -1;
int goalstate = -1;
for(int z = 0; z < n.getState().getState().length; z++)
{
if(n.getState().getState()[z] == i)
{ current = z; break; }
}
for(int z = 0; z < finalState.getState().length; z+... |
fd80281f-0ac4-4cd2-ae03-4a70671cc3ba | 3 | private void placeLightGrenades() {
while (getElementCoverage(LightGrenade.class) < COVERAGE) {
final Position randomPos = getRandomPosition();
final LightGrenade lg = createLightGrenade();
if (grid.validPosition(randomPos) && canHaveAsElement(randomPos, lg))
grid.addElementToPosition(lg, randomPos);
}... |
2f78b2dc-c7cf-4333-aecf-81307d2e5f63 | 2 | public void boxBlur(CPRect r, int radiusX, int radiusY) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(r);
int w = rect.getWidth();
int h = rect.getHeight();
int l = Math.max(w, h);
int[] src = new int[l];
int[] dst = new int[l];
for (int j = rect.top; j < rect.bottom; j++) {
System.ar... |
f8683a7f-2b7a-49b4-a2d1-1c5b4499579b | 8 | @Override
public void run() {
try {
System.out.println("Enter command: (print/flush/exit)");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String command = "";
while(!command.equals("exit")) {
command = in.readLine()... |
a912ba09-12b6-4fa5-93f9-6b519c588614 | 2 | public double getScore(Word w, SubSeqCounter counter) {
// Smooth sub-minimal scores
double score = Math.max(w.getScore(time), getSmoothingMin());
// Account for normalization, and then sequence frequency
score = NORMALIZATION ? score / numTokens : score;
score = counter != null ? score / counter.get(w.units... |
3f6b240e-75ea-4695-b473-401c99191cfb | 7 | @Override
public List<Block> getBlocks(String blockName, String outerBlockNames)
throws RemoteException {
String BlockName = null;
String BlockText = null;
if( outerBlockNames == null){
return null;
}
if((null == blockName.toString()) || ("" == blockName.toString())){
return null;
}... |
17f27375-28de-4485-8fcc-d567345b36cb | 8 | private Piece getRandomPiece() {
switch(rand.nextInt(8)) {
case 0:
return new Line(start);
case 1:
return new L(start);
case 2:
return new Squiggly(start);
case 3:
return new Square(start);
case 4:
return new T(start);
case 5:
return new Hook_L(start);
case 6:
return new Hook_R(star... |
8b33b8cc-9b76-4ac8-a5a6-9b0d7c5f8b2d | 8 | public static Event create(Connection connection, Event event) {
PreparedStatement preparedstatement = null;
try {
Calendar calendar = Calendar.getInstance();
calendar.set(1900, 0, 1);
preparedstatement = connection.prepareStatement("insert into civicrm_event values ... |
e0a64036-5de1-44f5-a8ee-85e4a051b463 | 1 | public boolean update(Libros l){
PreparedStatement ps;
try {
ps = mycon.prepareStatement(
"UPDATE Libros "+
"SET nombre=?, titulo=?, autor=?, cantidad=? "+
"WHERE codigo=?"
);
ps.setString(1, l.getNombrelibro());
... |
13d2b40d-1c5d-42e2-a8ad-38d2a8d2cc0a | 0 | public String showKinds(){
return SUCCESS;
} |
1af6891e-dd83-4709-ab67-e8e4a76af507 | 5 | public final void fill() {
if (this.master.isInterrupted()) {
return;
}
Debug.print("Searching for songs at \"" + this.tree.getRoot() + "\".\n");
final Deserializer sdd = Deserializer.init(this, this.master);
final Scanner scanner = new Scanner(this.master, sdd, this.tree);
final Crawler crawler = new C... |
badbcd55-7b6e-4148-949e-101f327ab747 | 3 | public int agregarUsuario(String code, String name, String surname1, String surname2, String username, String mail, String date, String position, String rol, String pass){
int condicion = 0;
//Validando si usuario existe
tablaDeUsuarios();
for (Usuario Usuario : data){
... |
6066d05a-c746-4191-8aec-0d839560f622 | 9 | private void updateRecord()
{
updateGrbit();
byte[] recbytes = new byte[0];
byte[] tmp = ByteTools.cLongToLEBytes( grbit );
recbytes = ByteTools.append( tmp, recbytes );
recbytes = ByteTools.append( dTitlePrompt.read(), recbytes );
recbytes = ByteTools.append( dTitleError.read(), recbytes );
recbytes = ... |
ca06344d-19d6-4c62-9964-bcbd9fb5175c | 2 | private void calcHeuristic(TrieNode node) {
if (node.isLeaf()) {
node.setHeuristic(PRECISION_MULTIPLIER / node.getDepth());
} else {
for (TrieNode child : node.getChildren().values()) {
calcHeuristic(child);
}
node.setHeuristic(getMinChildHeuristic(node));
}
} |
7ec8950b-1949-4071-94c3-571cfe875103 | 8 | public String[] split(String sql) {
List<String> lst = new LinkedList<String>();
int i=0;
int lastsplit = 0;
char[] ca = sql.toCharArray();
boolean isvalue = false;
char nextendCharacter = ' ';
for(i=0;i<ca.length;i++) {
if(isvalue == false && (ca[i] == '\'' || ca[i] == '"')) {
nextendCharacter = ... |
07d19dba-7c0b-41e5-ad7b-0eea47ca41e9 | 9 | protected void noResponseRequests(){
if(!this.allNoResponseOptionsSet){
if(!this.ignoreNoResponseRequests){
// Options for no responses at a level that leads to item deletion
if(this.personDeletionPercentage!=0.0){
if(!this.itemDeletionPercentage... |
f2e1de9a-4664-4646-8327-c7bf53bfb1bb | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Userrole)) {
return false;
}
Userrole other = (Userrole) object;
if ((this.userroleid == null && other.userrole... |
f050bdec-36ec-4f4f-8ebe-79ccb5d3cfab | 5 | public void drawMove(Graphics g, int depth, double tX, double tY, String order){
//order stuff
String base = "01,02,12";
for (char c: order.toCharArray()){
String[] b = base.split(",");
switch(c){
case 'T':
base=""+b[2].charAt(1)+b[2].charAt(0)+","+b[1].charAt(1)+b[1].charAt(0)+","+b[0].charAt(1)+b... |
c7776c58-43fb-494f-a8ae-ab2efc758ad7 | 0 | public AbstractPlay get(int number) {
return bestPlays.get(number);
} |
db10664d-c2ef-4ef0-90c5-25cceffa9c07 | 3 | public void deletePolygon(Vertex v)
{
if (v == null) return;
if (v.getClass() != Point.class) return;
Point p = (Point)v;
Point q = p;
do {
vertices.removeVertex(q);
q = q.getRight();
} while (q != p);
} |
5ef3fc9a-e78b-4793-98d4-934671a7528d | 0 | public void sacar(double valor)
{
this.saldo -= valor;
} |
eb8610ed-7efa-4107-afcb-d5b8feb7c2bc | 2 | private void updateJoysticks() {
for (int i = 0; i < joystickAxes.length; i++) {
if (joystickAxes[i] == null) {
continue;
}
updateJoystick(i);
}
} |
2d6c5e19-b962-4694-a689-a8d64797ab46 | 7 | public void returnBooks() {
// User inputs: callNumber, copyNo of book to be returned
JTextField copyNoField = new JTextField(10);
JTextField callNumbersField = new JTextField(20);
JComponent[] inputs = new JComponent[] {
new JLabel("Call number:"), callNumbersField,
new JLabel("Copy Number:"), copyN... |
e127a3c2-4071-4408-99ad-ae36d590d68b | 2 | static public void codeAllFilesInDirectory(String src)
{
File folder = new File(src);
File[] listOfFiles = folder.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
System.out.println(file.getName());
codeFile(file.getPath());
}
}
} |
07016491-f230-478e-bd15-0afc873154e3 | 2 | public Node getKthNode(Node currNode,int kPos, NodeIndex i){
if(currNode==null)
return null;
Node node = getKthNode(currNode.getNextNode(), kPos, i);
i.index = i.index + 1;
if(i.index==kPos)
return currNode;
return node;
} |
f44f902a-8b10-4254-a088-695fda6c2ecd | 4 | @Override
public final void visitInnerClass(final String name,
final String outerName, final String innerName, final int access) {
if (innerClasses == null) {
innerClasses = new ByteVector();
}
++innerClassesCount;
innerClasses.putShort(name == null ? 0 : newC... |
2a3b2e6b-a257-4295-b387-161a3a6609bc | 9 | private void normalizeFields(List<Field> fields, Class<?> clazz) {
for (ListIterator<Field> it = fields.listIterator(); it.hasNext();) {
Field f = it.next();
int mod = f.getModifiers();
if (Modifier.isTransient(mod) || Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
it.remove();
}... |
232ceb81-0d87-45e3-9317-d8b8d7c92212 | 9 | public static void setZero(int[][] matrix){
Vector<Integer> rows = new Vector<Integer>();
Vector<Integer> cols = new Vector<Integer>();
for (int i = 0; i < matrix.length; i++){
for (int j = 0; j < matrix[i].length; j++){
if (matrix[i][j] == 0){
if (!rows.contains(i)){
rows.add(i);
}
... |
40a9b4b6-ef92-4fc1-a99f-20edca885c5f | 5 | public String strStr(String haystack, String needle) {
if(needle.length() ==0)
return haystack;
int [] next = getNext(needle.toCharArray());
int i = 0;
int j = 0;
while(i < haystack.length()){
if(j == -1 || haystack.charAt(i)== needle.charAt(j)){
... |
9d3a09d9-7338-4fe1-bfb5-e80297154d58 | 2 | public String GetName() {
Resource.Tooltip tt;
if ((res.get() != null)
&& ((tt = res.get().layer(Resource.tooltip)) != null))
return tt.t;
else
return "";
} |
416b4171-586a-4aa3-b258-71e860a4595a | 8 | @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... |
56ef2965-99c9-4efb-b747-db151df35db7 | 3 | public boolean equals(Vector4 v) {
return x == v.x && y == v.y && z == v.z && w == v.w;
} |
dfb3aaa9-8f6f-4e37-95d7-4e670ba17c18 | 4 | public Set<Piece> getVision() {
double circleX1 = (getX() - visionRadius);
double circleY1 = (getY() - visionRadius);
Ellipse2D circle = new Ellipse2D.Double(circleX1, circleY1,
visionRadius * 2, visionRadius * 2);
Set<Piece> piecesSet = new HashSet<Piece>();
for (Piece piece : TDGame.getInstance().get... |
40e3c431-cf25-4aff-a209-d887f80f06f5 | 9 | public void testResetAfterInterrupt() {
try {
final CyclicBarrier start = new CyclicBarrier(3);
final CyclicBarrier barrier = new CyclicBarrier(3);
for (int i = 0; i < 2; i++) {
Thread t1 = new Thread(new Runnable() {
public void run() ... |
b65cb26a-4207-4c79-acac-5dd5122ba44e | 9 | public List<StatistikMeldung> getMeldungen() {
if (nurAktuelle) {
maxWonInRow.clear();
}
Collection<Spieler> offeneSpieler = new HashSet<Spieler>(currentWonInRow.keySet());
for (Spieler spieler : offeneSpieler) {
calcSpreeForSpieler(spieler);
}
List<Map.Entry<Spieler, Integer>> entries = new ArrayL... |
b0bda230-d905-4876-9ac2-a51c35a6dead | 0 | public String getToolTip() {
return "Tool";
} |
906c5195-e206-4241-9b2f-b0ca77e924ff | 0 | public void setID(String iD) {
ID = iD;
} |
5233222b-55dd-45c9-a053-9a833609affa | 7 | @Override
public double timeToReach(Node startNode, Node endNode, Message msg) {
// TODO Auto-generated method stub
double dist = startNode.getPosition().distanceTo(endNode.getPosition());
/* Link rate | time arrive mSec | dist
* ----------------------------------------------------
* 11 | 2542 | 399
... |
19054dba-c13a-4fed-848f-d73013af6205 | 7 | public synchronized void startEntropySession() {
if(freeForEntropy) {
// System.out.println("---------------------------------------");
// System.out.println(Arrays.toString(lastContacts.toArray()));
// System.out.println("---------------------------------------");
if(lastContacts.size() == num_connecte... |
4ec88f7d-f2bf-4fee-a89c-54c8ba60c8f1 | 1 | @Override
public boolean isValid() {
return data != null && field.isAccessible();
} |
88a70861-9c34-42cf-b29d-259b5dc6de51 | 0 | public CreateData() {
// TODO Auto-generated constructor stub
} |
fa52dd60-2fe9-43ce-847c-744dde93323c | 7 | public void setHeader(File file, String[] header)
{
if (!file.exists()) {
return;
}
try
{
String currentLine;
StringBuilder config = new StringBuilder("");
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((currentLine = reader.readLine()) != null)
{
config.ap... |
0d858823-a2fc-411b-b91a-05abfcefcc99 | 7 | private static void process(String inFile, ArrayList<String> output) throws FileNotFoundException {
Scanner scanner = new Scanner(new FileInputStream(inFile));
while (scanner.hasNext()) {
int size = scanner.nextInt();
scanner.nextLine();
for (int i = 1; i <= size; i++... |
39ed0222-751d-4cc8-b835-249f4f3bd8ea | 4 | private DomainXmlBuilder addResources(Metadata metadata) {
for (Resource resource : metadata.getResources().values()) {
if (resource instanceof Database) {
addDatabase((Database) resource);
} else if (resource instanceof Email) {
addEmail((Email) resource)... |
5790c1e1-e650-4970-ba2e-53f90c36d03d | 9 | public void begin() {
while( true ){
String line = readLine( 100 );
if( line== null || line.equals("")) break;
StringTokenizer st = new StringTokenizer( line );
int start = Integer.parseInt( st.nextToken() );
int end = Integer.parseInt( st.nextToken() );
boolean reverse = ... |
50991498-ad4a-42bb-b87b-2fc676df1833 | 2 | @Override
public boolean notifyWrite(int address, Data data) { //Method to prompt memory to receive data from system bus (write)
//No checking of address being empty or not; up to assembly programmer
if (address < 100 && address >= 0) {
MEMORY[address] = data;
fireUpdate(display());
return true;
}
ret... |
e05d60ba-fac3-4923-b84a-6b732a6aedb3 | 5 | public Item randomItem(int tier){
switch(randNum.nextInt(5)){
case 0:
return randomWeapon(tier);
case 1:
return randomArmor(tier);
case 2:
return randomTrinket(tier);
case 3:
return randomConsumable(tier);
case 4:
return randomLoot(tier);
}
return null;
} |
b38a96bb-e81f-4c16-9f99-4502bb87bf79 | 9 | @Override
public String operator(String op) {
float digit1;
float digit2;
float result;
decimalEntered = false;
//is the stack big enough?
if ((stack.size() == 1 && currentNums.equals("")) || (stack.size() < 1) ){
... |
dde8637f-2635-4509-a561-7ea1e7e468de | 7 | boolean isIntegerAttributeTypeValueRangeProcessable(ConfigurationValueRange configurationValueRange, IntegerValueRange integerValueRange) {
if(!isConfigurationDataChangeable("atg.ganzzahlAttributTypEigenschaften")) {
if(configurationValueRange == null && integerValueRange == null) {
return true;
}
else i... |
701ec649-1b25-4f36-aa7b-2f33bd16c197 | 9 | public static int searchFor(byte[] buffer, byte[] searchFor, int iStartBufferOffset) {
int iWrk = iStartBufferOffset;
int iX;
if (buffer == null)
throw new NullPointerException("buffer is null");
if (searchFor == null)
throw new NullPointerException("searchFor is null");
if (iStartBufferOffset < 0)
... |
651d5abc-53b7-4a72-ad4f-c5a0a1bd6867 | 0 | private void setUpComboBoxColumn() {
createComboBox();
table.getColumnModel().getColumn(1)
.setCellEditor(new DefaultCellEditor(comboBox));
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
table.getColumnModel().getColumn(1).setCellRenderer(renderer);
} |
402a65cc-cb50-474f-a9e3-9e40dce19225 | 9 | public String getAttribute(String attr){
switch(attr){
case "Image":
return imgName;
case "Id":
return Integer.toString(id);
case "Area":
return Integer.toString(area);
case "Mean":
return Double.toString(mean);
case "Centroid":
return centroid.toString();
case "Prev":
return... |
b06106a7-994c-46d2-9a51-7c16f2968cef | 5 | protected int readBlock() {
blockSize = read();
int n = 0;
if (blockSize > 0) {
try {
int count = 0;
while (n < blockSize) {
count = in.read(block, n, blockSize - n);
if (count == -1)
break;
n += count;
... |
e11b4a93-ac4b-46ee-92cf-8137a7c90a31 | 8 | private ArrayList<Site> cornerFinder() {
ArrayList<Site> corners = new ArrayList<Site>();
for(Site vertex: vertices) {
if(!dungeon.isRoom(vertex)) continue;
Queue<Site> tempNeighbors = graph.neighbors(vertex);
ArrayList<Site> neighbors = new ArrayList<Sit... |
8535d4ad-8787-44af-827a-7a70aa54b7c0 | 3 | private void createMenuBar() throws InstantiationException {
// Create the main
JMenuBar mainBar = new JMenuBar();
// Create the file menu items.
JMenu fileMenu = new JMenu("File");
mainBar.add(fileMenu);
JMenuItem closeMenuItem = new JMenuItem(... |
dff5c15f-63cf-43db-8148-6362a7ef383c | 1 | private boolean jj_3R_38() {
if (jj_3R_84()) return true;
return false;
} |
ba0b4e44-87ac-41fb-a47d-d7dfca297006 | 2 | public boolean postdominates(final Block block) {
Block p = block;
while (p != null) {
if (p == this) {
return true;
}
p = p.pdomParent();
}
return false;
} |
27b83232-857c-493e-9f34-1cb5a0313c6e | 4 | @Override
public void mousePressed(MouseEvent e) {
if (getView().getToolBar().getBounds().contains(e.getPoint())) {
this.x0 = e.getX();
this.y0 = e.getY();
this.isMovingToolBar = true;
}
else if (e.getButton() == MouseEvent.BUTTON1) {
if (this.getModel().getCurrentTool() == Tool.DRAW) {
this.isDr... |
62a8843f-d9ac-4e2b-a47c-57c958865220 | 0 | public int getPoints() {
return points;
} |
7e166933-c6eb-418c-95e2-9cbff086e738 | 1 | public LocalDebugInfo[] locals() {
if (locals != null) {
return locals.locals();
}
return new LocalDebugInfo[0];
} |
90e0251d-ad6c-46ab-aa37-f36af5b4fe87 | 5 | public Problem validate(final Object instance,
final MatchField annotation, final Object target,
final Object actualValue)
{
Object expectedValue;
try
{
final String fieldName = annotation.value();
final Field field = instance.getClass().getField(fieldName);
expectedValue = field.get(i... |
0097778e-2611-4975-8096-8fd885f2a8e3 | 4 | private void handleWorkerInfoReport(Message workerMsg){
Integer processId;
HashMap<Integer,ProcessInfo.Status> workerStatus = workerMsg.getWorkerInfo();
if(!workerStatus.isEmpty()){
Set<Integer> id = workerStatus.keySet();
Iterator<Integer> idIterator = id.iterator();
... |
b7051a03-f05f-4bed-a912-6cde4e83d308 | 1 | public boolean equals(Object o)
{
boolean equals = false;
if (o instanceof OutputChannels)
{
OutputChannels oc = (OutputChannels)o;
equals = (oc.outputChannels == outputChannels);
}
return equals;
} |
df8ab201-b741-4d47-8cb7-40037351fd13 | 1 | private void loadPlayers(int currentPlayersPosition, int quantity) {
// TODO Auto-generated method stub
lobby.setStatus("Loading Players");
this.currentPlayersPosition = quantity;
String result = sendMessageToServer(
GameSocketServer.GET_PLAYERS_ONLINE, ",startAt="
+ currentPlayersPosition + ",quantit... |
59f75258-8208-4352-9910-0d4319c72389 | 7 | @Override
Object unpack(Info vi, Buffer opb) {
InfoFloor0 info = new InfoFloor0();
info.order = opb.read(8);
info.rate = opb.read(16);
info.barkmap = opb.read(16);
info.ampbits = opb.read(6);
info.ampdB = opb.read(8);
info.numbooks = opb.read(4) + 1;
... |
a8b23800-a224-49d2-a52a-18a791509320 | 4 | public void ensureBlack() {
for (int i = 0; i < ximlen; i++) {
for (int j = 0; j < yimlen; j++) {
if (img_alpha[i][j] > 0) {
img_red[i][j] -= (long) ((double) img_red[i][j] / img_alpha[i][j]);
img_green[i][j] -= (long) ((double) img_green[i][j] / img_alpha[i][j]);
img_blue[i][j] -= (long) ((doub... |
95dd6a9c-0f1a-46ca-9471-fe57f94c1658 | 9 | public void paint(Graphics gr)
{
Image i=createImage(getSize().width, getSize().height);
Graphics2D g2 = (Graphics2D)i.getGraphics();
if (status==Status.Run || status==Status.OneStep)
{
g2.setColor(Color.BLACK);
g2.fillRect(0,0,SCWIDTH,SCLENGTH);
S... |
74fd1d75-5c39-4b73-acb2-7909e2fc22bd | 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... |
634c9ff8-d5fe-42ee-a0ec-43265ad050bb | 8 | public void init( )
{
SecurityManager securitymanager = System.getSecurityManager();
if (securitymanager != null)
{
try{
securitymanager.checkSystemClipboardAccess();
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
if (debug) System.out.println("Using system cl... |
183dd431-304d-4898-be0d-7059453326d5 | 2 | public void display(){
int cellID = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.print(cells[cellID].getType().getTextualIcon());
++cellID;
}
System.out.println();
}
} |
09a3f71c-e114-4ac2-b3b5-648d91c41bb4 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GateService other = (GateService) obj;
if (internalID == null) {
if (other.internalID != null)
return false;
} else if (!internalID.equa... |
a56d749c-5ece-4b65-85ed-0e895bad1b16 | 4 | public static void main(String[] args) {
//Setting up some objects to test.
Colour[] four = new Colour[4];
Colour[] five = new Colour[5];
Colour[] six = new Colour[6];
Colour white = new Colour("#FFFFFF");
four[0] = white;
five[0] = white;
six[0] = white;
Colour black = new Colour("#000000");
fou... |
690be405-1293-4745-827f-d686d12038d3 | 4 | public String getBrokerInfo() {
String brokerStr = "";
try {
int numPartitionsForTopic = getNumPartitions();
String brokerInfoPath = brokerPath();
for (int partition = 0; partition < numPartitionsForTopic; partition++) {
int leader = getLeaderFor(partition);
String path = brokerInfoPath + ... |
18a86cf3-50f0-4d41-bcaa-a03327bc7ea5 | 1 | static String nextWhiteMove(){
if(!whiteOpening.isEmpty())
return whiteOpening.remove(0);
else
return null;
} |
aac8aba3-f4ac-42b6-9b89-0ff6da86c333 | 7 | public static int[] Eratosthenes(int maxPrimeNumber) {
// Define new vector A with all numbers from 2 to N
int[] vectorA = new int[maxPrimeNumber + 1];
for (int index = 2; index <= maxPrimeNumber; index++) {
vectorA[index] = index;
}
int nonPrimeCount = 0;
// Flag all non-primes in vecto... |
06cc70a6-791f-4e18-b08a-85f75b4c35cc | 6 | public void gen_eval_body(Map<String, Object> context, QLSelect select, PrintWriter out) {
Class<?> clazz = (Class<?>) context.get("class");
if (clazz == null) {
throw new IllegalArgumentException("context not contains 'class'");
}
String className = clazz.getName();
... |
927e7493-bb32-4a35-9ef8-43db61884874 | 5 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
Player player = e.getPlayer(); //grabbing player
String logString;
if //begin check staff (this is hard coded and will be removed in a later version)
(
(player.hasPermission("oasispixelgyms.gyms.leader") || (player.hasPermission("oasispixelgyms.gy... |
676896f6-e63b-4c19-94fd-237794875079 | 0 | public static HTTPRequestHandler getInstance()
{
return instance;
} |
30d15b40-6048-42ed-a89b-d80873da1634 | 2 | public final TLParser.ifStat_return ifStat() throws RecognitionException {
TLParser.ifStat_return retval = new TLParser.ifStat_return();
retval.start = input.LT(1);
Object root_0 = null;
Token If63=null;
Token Do65=null;
TLParser.expression_return expression64 = null;
... |
6a5cbef3-8598-4896-b25b-6273109209c3 | 8 | @Override
public TreeValue next() {
// check left branch
if (place.hasLeftSon()) {
place = place.getLeftSon();
way.push(place.getValue(), place.getId(), place.getLeftSon(), place.getRightSon());
return this.next();
}
// check right branch
i... |
badc6506-dd07-4e67-9f45-c846016fe968 | 5 | public int getUnitCountByType(UnitType type) {
int anzahl = 0;
for(Legion l : stationaryArmy.getUnits()) {
if (l.getType() == type) {
anzahl = l.getCount();
break;
}
}
for(Army a : movingArmies) {
for(Legion l : a.getUnits()) {
if (l.getType() == type) {
anzahl = anzahl + l.getCount();... |
a192d1da-06ab-4d3e-a088-979a7066eead | 9 | public FullPalletTestJC() {
ArrayList<CSIColor> list = new ArrayList<CSIColor>();
for (int i = 0; i < CSIColor.FULL_PALLET.length; i++) {
list.add(CSIColor.FULL_PALLET[i]);
}
Collections.sort(list);
try {
mainInterface = new JCursesConsoleInterface();
... |
1fdf3067-448f-4fae-979f-4475532787e8 | 8 | public void modify() throws IOException{
String s;
int val = 0;
Out.getDisp().renderLine("Would you like to change the prompt? (Y/N)");
s = Input.inputString();
if (s.equals("Y")||s.equals("y")){
Out.getDisp().renderLine(prompt);
Out.getDisp().renderLine("Please input a new prompt.");
s = Input.in... |
0b6f183a-b7bb-416f-8435-0bbd245f9d63 | 4 | private List<Reducer> estimateReducers(List<Mapper> newMapperList, boolean useRuntimeMaxJvmHeap) {
int fReducerNum = finishedConf.getMapred_reduce_tasks();
if(fReducerNum == 0)
return null;
//if(isMapperConfChanged == false && isSplitSizeChanged == false && isReducerConfChanged == false)
// return job.getR... |
0156c004-a6ba-4dc9-aa78-fb532e351dfa | 1 | private static void reverseCharArray(char [] inputStrArray, int min, int max)
{
char temp;
for (int count =0; count < (max-min)/2;count++)
{
temp = inputStrArray[min+count];
inputStrArray[min+count] = inputStrArray[max-count -1];
inputStrArray[max-count -1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.