method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dfd5c244-dcc4-4fbb-9cac-0cda6a902fd3 | 2 | public double[] subarray_as_degrees_phase_of_Phasor(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Phasor[] pp = this.getArray_as_Phasor();
double[] phased = new double[end-start+1];
... |
3241b587-45f7-4129-8cb2-6c07211c5dda | 3 | public static List<ArrayList<Double>> getCenters(String inputpath){
List<ArrayList<Double>> result = new ArrayList<ArrayList<Double>>();
Configuration conf = new Configuration();
try {
FileSystem hdfs = FileSystem.get(conf);
Path in = new Path(inputpath);
FSDa... |
f73f6598-4c7f-456d-a783-21b0c0d4e177 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AutomatoImpl automato = (AutomatoImpl) o;
if (!alfabeto.equals(automato.alfabeto)) return false;
if (!estadoInicial.equals(automato.estadoInici... |
5c20ab19-3d03-4d4f-9829-35f2314b108e | 0 | public OutlinerSubMenuItem() {} |
d37084c0-50dc-45d4-b633-b2f84c5e2582 | 3 | public TestCompareCds(String genomeVersion, String configFile) {
config = new Config(genomeVersion, configFile);
cdsByTrId = new HashMap<String, String>();
try {
if (!quiet) System.out.print("Loading predictor " + config.getGenome().getVersion() + " ");
config.loadSnpEffectPredictor();
if (!quiet) Syste... |
d8ede7f6-abd0-48be-a48d-989152607e5d | 3 | public int AddCell(String Text, String ID, int colspan, int rowspan) {
//Controllo se è stato creato l'oggetto tabella
if (this._PdfPTable != null) {
//Controllo se l'ID sia presente nella lista
for (int i = 0; i < this._MyCellList.size(); i++) {
if (this._MyCell... |
20d22088-792a-4d37-9d9b-81edd408aa2b | 9 | public static String findFile(File root, String name)
throws PatternSyntaxException {
Pattern p = Pattern.compile(name, Pattern.CASE_INSENSITIVE);
Deque<Filer> next = new ArrayDeque<Filer>();
for (File f : root.listFiles()) {
if (p.matcher(f.getName()).matches())
return f.getName() + (f.isDirectory() ? ... |
a3195120-dc52-4b64-a9f4-371553ea2508 | 5 | public static Color[] createMultiGradient(Color[] colors, int numSteps) {
// we assume a linear gradient, with equal spacing between colors
// The final gradient will be made up of n 'sections', where n =
// colors.length - 1
int numSections = colors.length - 1;
int gradientIndex = 0; // points to the next op... |
b45238fa-bd73-468b-b280-07decd0b6a15 | 6 | private void buildOutlineElement(Node node, String lineEnding, StringBuffer buf, int max_style_depth) {
indent(node, buf);
// Calculate CSS Class
String cssClass = "";
if (node.isLeaf()) {
if (node.isComment()) {
cssClass = CSS_LEAF_COMMENT;
} else {
cssClass = CSS_LEAF;
}
} else {
if (... |
f55f99c2-7192-4152-b976-62152251e9f9 | 1 | public void setStatustextZoomedFontsize(int fontsize) {
if (fontsize <= 0) {
this.statustextZoomedFontSize = UIFontInits.STATUSZOOMED.getSize();
} else {
this.statustextZoomedFontSize = fontsize;
}
somethingChanged();
} |
ca63be84-6f8e-4f55-b7d6-bc8f728afb4e | 0 | public InvalidMove() {
} |
09e944c5-1648-4469-b5e3-68a5fa596456 | 5 | public static double getMinObservation(ArrayList<Observation>[] list, Vector2d reference){
if(list == null) return 0;
double result = Double.MAX_VALUE;
for(int i=0; i<list.length; i++){
for(int j=0; j<list[i].size(); j++){
double distance = list[i].get(j).position.dist(reference)... |
3926cab0-b1a9-4dd5-b1fa-6eabe294d0eb | 7 | public void calculateRelativeFrequenciesPerRole() {
featureValueFrequency.put("all", new MultiSet<String>());
featureValueFrequency.get("all").add("all", totalCount);
for (String featureType : FeatureTypes.getUsedFeatures()) {
if (featureType.contains(Const.roleTypeIdentifier)) {
int roleIndex = 0;
St... |
755e26f4-0956-4eaa-b849-392f8af4bd92 | 0 | public void onStart(IContext context) throws JFException {
engine = context.getEngine();
indicators = context.getIndicators();
console = context.getConsole();
} |
38e9be15-f11c-4d65-a0f0-f659ac1d4853 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Board))
return false;
Board other = (Board) obj;
if (N != other.N)
return false;
if (hamming != other.hamming)
return false;
if (manhattan != other.manhattan)
... |
42ff4057-e51c-4318-9998-9202f51569e9 | 8 | private void consolodateInts()
{
for(int i=0;i<intArray.length-1;i++)
{
if(((intArray[i]&NEXT_FLAG)==0)
&&(intArray[i]+1==(intArray[i+1]&INT_BITS)))
{
if((intArray[i+1]&NEXT_FLAG)>0)
{
if((i>0)&&((intArray[i-1]&NEXT_FLAG)>0))
{
shrinkIntArray(i,2);
return;
}
shrinkI... |
d1286179-aa29-473c-8a45-631c98d27772 | 0 | public void onMessage(IMessage message) throws JFException {
} |
96be97a7-f97d-405f-9932-51a78c08730e | 7 | @Override
public List<Orientador> Buscar(Orientador obj) {
String sql = "select a from Orientador a";
String filtros = "";
if(obj != null){
if(obj.getId() != null){
filtros += "a.id = " + obj.getId();
}
//ver ... |
cf3dc682-68c3-4206-947c-365885b86d75 | 2 | public void decrement(int by) {
// if given value is negative, we have to increment
if (by < 0) {
decrement(Math.abs(by));
return;
}
// cut off full overflows
by %= (range + 1);
// check if we would still overflow
int space_down = value - min;
if (by > space_down) {
// we check how big overfl... |
f50b8dd0-e76c-4773-86cd-c71aa6a0351f | 2 | @Override
public Set<FoodObject> lookUpFoodByCollection(Collection<String> names) {
Set<FoodObject> result = new HashSet<FoodObject>();
for (String name : names) {
if (cachedFoodObjectMap.containsKey(name)) {
result.add(cachedFoodObjectMap.get(name));
//TODO: fall back to db
}
}
return result;
} |
c96ef029-a26f-40a1-be8a-bc5235481ae4 | 4 | public static void extractEntry(ZipFile zipFile, ZipEntry entry, String destDir) throws IOException {
File file = new File(destDir + "/" + entry.getName().replace("\\", "/"));
if (entry.isDirectory()) file.mkdirs();
else {
file.getParentFile().mkdirs();
InputStream is = null;
OutputStream os = null;
t... |
f5904cc7-128f-4a0b-8a47-f9833acbb2e7 | 2 | private Boolean isAPropertiesFile(final String filePath) {
String[] splitted = filePath.split("\\.");
if ((splitted.length > 1) && (splitted[1]).compareTo(PROPERTIES_FILE_EXTENSION) == 0) {
return true;
}
return false;
} |
d1928e40-638c-4f8d-a7a5-b051f7057c09 | 4 | public void speciate(List<Organism> organisms) {
/* All other genomes are placed into species as follows:
* A random member of each existing species is chosen as its permanent representative.
* Genomes are tested one at a time; if a genome’s distance to the representative of any
* e... |
f18581eb-34e3-400f-8cf9-75b0bf823b89 | 8 | protected void execute() {
velocity = oi.getRawAnalogStickALY();
turn = oi.getRawAnalogStickARX();
if (Math.abs(velocity) < .05) {
velocity = 0;
}
if (Math.abs(turn) < .05) {
turn = 0;
}
if (vPrev - velocity > rampThreshold) {
... |
f62a2567-5377-4ef4-9299-f0703f4b1bc3 | 8 | private Color getColorWithIndex(int index) {
Color color = null;
switch (index) {
case 0:
color = Color.ORANGE.darker();
break;
case 1:
color = Color.CYAN.darker();
break;
case 2:
color = Color.GREEN.darker();
break;
case 3:
color = Color.YELLOW.darker();
break;
case 5:
color = ... |
d7387983-7c9a-4e91-9955-88dc8908721b | 0 | public ArrayList<String> getQuestAnswer() {
return questAnswer;
} |
6050f8aa-dc55-4faa-bf50-ebac4f0747a4 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... |
7151aa75-74bc-445b-babd-9f2a3057ce11 | 1 | public final void need(int count) throws VerifyException {
if (stackHeight < count)
throw new VerifyException("stack underflow");
} |
7f713934-4c03-46b3-b9de-9bb698b13922 | 8 | public static void sendPlayerToLastBack( BSPlayer player, boolean death, boolean teleport ) {
if ( player.hasDeathBackLocation() || player.hasTeleportBackLocation() ) {
player.sendMessage( Messages.SENT_BACK );
} else {
player.sendMessage( Messages.NO_BACK_TP );
}
... |
522c450c-de8a-4733-9fa0-8e4a738e857a | 1 | @Override
public void scoreGame(boolean won, int score) {
if (won)
System.out.println("You won the game!\n");
else System.out.println("You lost the game.\n");
} |
185baf8e-0f0e-425f-8309-4968c4c4c3b2 | 4 | public int read()
{
try
{
FileInputStream inStream = new FileInputStream("options.txt");
DataInputStream in = new DataInputStream(inStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
url = br.readLine(... |
5fc683e1-52c0-4813-ada4-c5033a2c6e61 | 4 | private void handleResize() {
paintCanvas.update();
Rectangle visibleRect = paintCanvas.getClientArea();
visibleWidth = visibleRect.width;
visibleHeight = visibleRect.height;
ScrollBar horizontal = paintCanvas.getHorizontalBar();
if (horizontal != null) {
displayFDC.xOffset = Math.min(horizontal.getSel... |
8760be5a-ed14-41be-be5d-771e91320997 | 6 | public int removeDuplicates(int[] A) {
int count = 1;
int countAll = 0;
int pre = Integer.MIN_VALUE;
int removed = 0;
HashSet<Integer> set = new HashSet<Integer>();
for (int i = 0; i < A.length; i++) {
int a = A[i];
if (a == pre) {
... |
099abc93-789b-4db0-8e74-4c4a47062de9 | 3 | public void replace(String statement) throws CannotCompileException {
thisClass.getClassFile(); // to call checkModify().
ConstPool constPool = getConstPool();
int pos = currentPos;
int index = iterator.u16bitAt(pos + 1);
Javac jc = new Javac(thisClass);
ClassPool cp =... |
21b87bd7-a01f-45d9-94c2-8c735ede5e82 | 6 | public static Level forName(final String name) {
if (name == null) {
throw new IllegalArgumentException("Name cannot be null for level");
}
if (name.toUpperCase().equals("NONE")) {
return NONE;
} else if (name.toUpperCase().equals("NOVICE")) {
return N... |
5c269b11-e8f9-4994-bf64-9ce0d98fa3f0 | 4 | public void moveOneStep(){
int sizeBase = AppliWindow.getInstance().getTilesSize();
boolean agentArrived = ((this.position.x > baseDestination.getPosition().x) && (this.position.x < baseDestination.getPosition().x + sizeBase)) &&
((this.position.y > baseDestination.getPosition().y) && (this.position.y < bas... |
7ea7b4bf-7f51-4f17-b0d9-7a817646d048 | 6 | public static boolean tryAvoidingEnemyTanks(Unit unit) {
// Our own tanks should engage enemy tanks.
if (unit.getType().isTank()) {
return false;
}
Collection<Unit> allKnownEnemyTanks = getEnemyTanksThatAreDangerouslyClose(unit);
for (Unit enemyTank : allKnownEnemyTanks) {
double distance = enemyTank... |
77d6208a-f5e0-45d8-a0a6-2db1f361f016 | 3 | void setTouched(int tt) {
map[tt] |= VISIT;
if ((map[tt] & NEB) == 0) { // no bomb around, auto flip
for (int i = 0; i < 8; i++) {
if ((map[tt + directions[i]] & VISIT) == 0) { // 已翻開就不用再做了
setTouched(tt + directions[i]);
}
}
}
} |
3a64fd90-505c-42aa-8e4e-6c415ecf1863 | 9 | public boolean isAssignableTo(Type type) {
if (eq(type.getCtClass(), Type.OBJECT.getCtClass()))
return true;
if (eq(type.getCtClass(), Type.CLONEABLE.getCtClass()))
return true;
if (eq(type.getCtClass(), Type.SERIALIZABLE.getCtClass()))
return true;
... |
4640d03a-c9df-40f0-8c6f-14a67ee3258f | 2 | public DefaultLinkNormalizer(final String beginUrl) {
if ((beginUrl == null) || (beginUrl.trim().length() == 0)) {
throw new IllegalArgumentException("beginUrl cannot be null or empty");
}
this.beginUrl = beginUrl;
} |
48b28c38-ebb3-442e-aa93-ea57ec9337cf | 4 | private static BufferedImage initRotatedImage(BufferedImage givenImage,
int rotationCenterX, int rotationCenterY, double rotatingAngle) {
double maxR = -99999;
// double minR = 99999;
final int maxX = givenImage.getWidth() - 1;
final int maxY = givenImage.getHeight() - 1;
final int minX = 0;
final int mi... |
031adc75-f165-449e-b4ef-8c07274000bf | 5 | public int addUser() {
String username = textField.getText();
char[] newpw = PWField.getPassword();
char[] repeat = PWField2.getPassword();
String repeatString = new String(repeat);
String newpwString = new String(newpw);
if (repeatString.equals(newpwString)) {
try {
answer = Switch.switchMethod("ad... |
25ce72a4-3758-4c38-8155-13fa20c0de75 | 8 | private void keyActionPerformed(final KeyEvent e) {
if (e.isControlDown()) {
if (e.getKeyCode() == KeyEvent.VK_N) {
this.actionPerformed(new ActionEvent(e.getSource(), -1, "New"));
} else if (e.getKeyCode() == KeyEvent.VK_O) {
this.actionPerformed(new Acti... |
7ff17bce-b958-4d24-b4e8-959bafb45a18 | 2 | public int compareTo(NGram other){
if(weight > other.getWeight()) return -1;
else if(weight < other.getWeight()) return 1;
else return 0;
} |
ba849e9c-e38c-4546-885a-49b9f60e0fde | 4 | public synchronized ArrayList<String> mobilesToBeDeleted() {
ArrayList<String> mobilesToBeDeleted = new ArrayList<String>();
ResultSet result = null;
String sqlUpdateTable;
double curtime = System.currentTimeMillis()/1000;
try {
connection = (Connection) DriverManager... |
b6f65c73-05d6-4287-abc4-281495b2391d | 7 | void buildPolyhedra() {
boolean useBondAlgorithm = radius == 0 || bondedOnly;
for (int i = atomCount; --i >= 0;)
if (centers.get(i)) {
Polyhedron p = (
haveBitSetVertices ? constructBitSetPolyhedron(i)
: useBondAlgorithm ? constructBondsPolyhedron(i)
: construc... |
41543ebf-519d-4c55-820f-c1a56ba6ec2a | 8 | private void GenreSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GenreSearchButtonActionPerformed
try {
userSocket = new Socket("127.0.0.1", 6666);
out = new PrintWriter(userSocket.getOutputStream(), true);
in = new BufferedReader(new InputStre... |
25206138-b58b-44af-adeb-da73729a2577 | 9 | public boolean isInterleave2(String s1, String s2, String s3){
if(s1.length() + s2.length() != s3.length()) return false;
boolean[][] matched = new boolean[s1.length() + 1][s2.length() + 1];
matched[0][0] = true;
for(int i1 = 1; i1 <= s1.length(); i1++){
if(s3.charAt(i1-1) == s1.charAt(i1-1)) {
matched[i... |
034d79d4-489c-48c9-b915-3510e97c85f1 | 5 | private void setToBlack(byte[] buffer, int lineOffset, int bitOffset,
int numBits) {
int bitNum = (8 * lineOffset) + bitOffset;
int lastBit = bitNum + numBits;
int byteNum = bitNum >> 3;
// Handle bits in first byte
int shift = bitNum & 0x7;
if (shift > 0) {
int maskVal = 1 << (7 - shift);
byte v... |
ba1005c8-0bd1-4bb0-b8ef-d78387b51cfc | 9 | public static List<Item> itemList(List<? extends Item> items, char c, HTTPRequest httpReq, boolean one)
{
if(items==null)
items=new Vector<Item>();
final Vector<Item> classes=new Vector<Item>();
List<Item> itemlist=null;
if(httpReq.isUrlParameter(c+"ITEM1"))
{
itemlist=RoomData.getItemCache();
for(i... |
2c8ae5c6-8b80-41e3-850f-161c352bbffc | 2 | public void update(int delta){
if(direction==LEFT){
setX(getX()-(SPEED*delta));
}else if(direction==RIGHT){
setX(getX()+(SPEED*delta));
}
} |
c650bfe4-cba2-4515-b86f-fce2d4e0aedb | 7 | public ConditionalEditor() {
setTitle("Conditional Editor");
setBounds(100, 100, 450, 300);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
cont... |
4afca25c-d963-4ba9-b059-079b3896d044 | 7 | @Override
public void run() {
mainLoop:
while (true) {
// update running status
for (int i = 0; i < maxClients; i++) {
running[i] = listeners[i].clientRunning();
success[i] = listeners[i].success();
}
boolean tmp = true... |
9ae1c4ad-0550-404d-99c0-d60802d6a79e | 5 | public void changeSignature(String person, String path, String newSign) {
try {
ArrayList<User> users = DataBase.getInstance().getUsers();
for (Iterator it = users.iterator(); it.hasNext();) {
User user = (User) it.next();
if (user.getLogin().equals(person... |
9532b099-f4b1-4c2b-b465-f101e9f3ef1b | 0 | @Override
public DataStructures getKit(){
return outData;
} |
68636602-3668-4a13-87cc-2d46a8c5c4eb | 9 | public boolean canMove(int player, Point position) throws
IllegalMoveException,
CorruptedBoardException,
GameEndedException,
DrawGameEndedException{
//previousBoard.print("PRZED RUCHEM (S)");
//checking if boards are equal
try{
areBoard... |
57586bc5-9b71-4b1f-ba8a-a8608bd8f8f9 | 7 | public mainClass() {
long startTime = System.nanoTime();
//System.out.println("Time 1: " + (System.nanoTime() - startTime) / 1000000);
Globals.getInstance().mainFrame = this;
Globals.getInstance().listsPacks = this;
Globals.getInstance().initializeFolders();
Globals.getInstance().loadPrefe... |
180d8647-799f-43ca-957f-d617fa5daf7b | 3 | public SingleTreeNode treePolicy(StateObservation state) {
SingleTreeNode cur = this;
while (!state.isGameOver() && cur.m_depth < ROLLOUT_DEPTH)
{
if (cur.notFullyExpanded()) {
return cur.expand(state);
} else {
SingleTreeNode next = cur... |
9b5131b4-64ea-414f-8c04-f236e3f7544e | 2 | private void addSensorEx(){
Sensor input = new Sensor();
input.setUnity("m");
input.setAddDate(new Date(System.currentTimeMillis()));
input.setLowBattery(false);
input.setStatementFrequency(1222);
input.setSamplingFrequency(1000);
input.setGpsLocation(-0.127512, 51.507222);
input.setName("Sensor_Arrow")... |
8a677d18-8cbb-4dd4-a65e-4424d1edfb55 | 0 | public static int getMaxStandardGenreId()
{
return MAX_STANDARD_GENRE_ID;
} |
dd5aa8a6-8d4b-4d3a-9be4-4a92fb3f6292 | 5 | public void changeSocket( int port, String host )
{
Socket newSocket;
System.out.println( "Connecting to " + host + ":" + port );
try
{
newSocket = new Socket( host, port );
System.out.println( "Connected to new socket" );
}
catch( ClosedByInterruptException ex )
{
System.out.println( "input str... |
0ff03725-0f7d-4331-8934-71937052ef95 | 7 | boolean canMove() {
if (!isFull()) {
return true;
}
for (int x : _0123) {
for (int y : _0123) {
Tile t = tileAt(x, y);
if ((x < ROW - 1 && t.equals(tileAt(x + 1, y)))
|| (y < ROW - 1 && t.equals(tileAt(x, y + 1)))) {... |
1609d831-af03-4855-b032-7e38c8b5727c | 5 | private void exec(String cmd){
try {
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
if (DEBUG) {
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while(line != null) {
System.out.println(line);
l... |
1928379a-bbc5-476f-ad63-8db0ac8a1e8e | 2 | @Override
public Writer addRecordEntry(final String columnName, final Object value) {
if (value != null) {
final ColumnMetaData metaData = this.getColumnMetaData(columnName);
final String valueString = value.toString();
if (valueString.length() > metaData.getColLength())... |
01f667d9-3793-401d-8c83-cafaecb9841c | 1 | public void addVertices(Vertex[] vertices, int[] indices,
boolean calcNormals) {
if (calcNormals) {
calcNormals(vertices, indices);
}
size = indices.length;
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData... |
e2fdfa9a-f561-46ab-89c8-abb4e734fc1a | 5 | public void izvrsi(HttpServletRequest req, HttpServletResponse res){
try{
int opcija=Integer.parseInt(req.getParameter("rd"));
atributPretrage="";
if(opcija==1){
atributPretrage = "naziv";
}
if(opcija==2){
atributPretrage = "opis";
}
... |
b04d5bb7-8267-4d87-91f1-1c37748559d9 | 8 | @Override
public void handle(Log log) {
String start = (String) this.getProperties().get("StartTime");
String end = (String) this.getProperties().get("EndTime");
if(start == null || end == null){
throw new IllegalArgumentException("Start and End Time NOT null");
}
List<Log> result = new ArrayList<Log>();
... |
4aaa050d-e709-475b-8492-a0f14e65b4f6 | 6 | Object remove(Object key) throws IOException {
int hash = hashCode(key);
long child_recid = _children[hash];
if (child_recid == 0) {
// not bucket/page --> not found
return null;
} else {
HashNode node = (HashNode) _recman.fetch( child_recid );
... |
8382f315-c1c3-4d25-98fc-57f274e145ce | 5 | @SuppressWarnings("unused") // For the console clearer below.
public static void main(String[] args) throws InterruptedException {
// System.out.println("The other threads dont like all these turtles"
// + " drawing over each other,\nJust ignore the oncomming spam");
World world = new World();
Turtle starte... |
d4fc4f0b-e252-4d7f-9f13-b96db300bdc1 | 4 | public static void readFile(String fileName) {
if (fileName == null) // Go back to reading standard input
readStandardInput();
else {
BufferedReader newin;
try {
newin = new BufferedReader( new FileReader(fileName) );
}
catch (Exception e) {
... |
28a4e8b9-c0e7-42c1-adb4-390f09db5176 | 9 | public Agent(int color, boolean learn){
bestMove = nullMove;
this.color = color;
if(color == Piece.BLACK){
currentMove = 1;
}
DatabaseParser parser = new DatabaseParser();
allOpeningMoves = parser.parseOpenings();
values = new HashMap<String, Integer>();
if(learn){
values.put("pawn",10);
value... |
5845db06-351e-492d-9edf-66b7a1edc8fa | 1 | public static synchronized Compiler singleton(URLClassLoader parent) {
if (instance == null) {
instance = new Compiler(parent);
}
return instance;
} |
66df8908-3500-4484-adbc-02a17f2df1a7 | 3 | public Expression combine(CombineableOperator comb) {
Operator combOp = (Operator) comb;
if (comb.lvalueMatches(this)) {
/* We already checked in canCombine that subExpressions match */
comb.makeNonVoid();
combOp.parent = parent;
return combOp;
}
for (int i = 0; i < subExpressions.length; i++) {
... |
144dc041-7e57-4e96-a54c-ff6fb7a63376 | 9 | public void BuildAdventureWorld(String AdventureFile) throws IOException
{
String line;
String data[];
Scanner scan = new Scanner (new File(AdventureFile));
for (int linenr = 1; scan.hasNextLine (); ++linenr) {
//looking for "r,d,o,t"
//split line
//split command --> myString.split("\\s+");... |
ab3d463a-1b5a-467c-ac24-7036678b9f8d | 2 | public String getTypeSignature() {
if (clazz != null)
return "L" + clazz.getName().replace('.', '/') + ";";
else if (ifaces.length > 0)
return "L" + ifaces[0].getName().replace('.', '/') + ";";
else
return "Ljava/lang/Object;";
} |
7df5bc52-9f42-4fc1-a4ab-bad46e10211b | 8 | public static int[] twoPair(Carta[] j){
int[] arr = new int[15];
for (int i = 0; i < j.length; i++)
arr[j[i].valor]++;
int par1 = 0, par2 = 0, remaining = 0;
for (int i = 0; i < arr.length; i++)
if(arr[i] == 2 && par1==0)par1 = i;
else if(arr[i] == 2)par2 = i;
else if(arr[i] == 1)remaining = i;
... |
d6050d6e-31a9-4e16-8712-56808eb036c7 | 6 | @Override
public void valueUpdated(Setting s, Value v) {
if (s.getName().equals(EndTrigger)) {
try {
boolean b = v.getBoolean();
if (b && endTrigger_ == null) {
endTrigger_ = addOutput("End trigger", ValueType.VOID);
} else if (!b && endTrigger_ != null) {
removeOutput(endTrigger_);
end... |
685b94c9-9aad-4001-98c8-07f11af4da5c | 2 | public void start() {
if(thread == null) {
thread = new Thread(this);
}
if(thread.getState() == Thread.State.NEW) {
thread.start();
}
} |
fc8b0dde-a6de-4f12-8d90-d76bfaecdbf7 | 3 | private void updateStateNotFound(List<Keyword> keywords, List<String> terms, List<String> approval) {
if (approval.size() == 1) {
if (approval.get(0).equals("yes") || approval.get(0).equals("Yes")) {
getCurrentDialogState().setCurrentState(Start.S_WAITING_FOR_EMPLOYEE_STATUS);
return;
}
else {
... |
d323b8ac-efa6-4260-8b2e-9fbab4a97d55 | 3 | public static Car driverCar(String car) throws Exception {
// 判断逻辑,返回具体的产品角色给Client
if (car.equalsIgnoreCase("Benz")) { // equalsIgnoreCase:String类的方法,两个字符串比较,不考虑大小写
return new Benz();
}
if (car.equalsIgnoreCase("Bmw")) {
return new Bmw();
}
if (car.equalsIgnoreCase("Audo")) {
return new Audo();
... |
e5ac963c-0827-4fbc-a672-b3325778e6b6 | 6 | private void initComponents() {
ListaAtracoes lstAtracoes = new ListaAtracoes();
PnlConjuntoImagens imagemMonumento = null;
JScrollBar scrollBar = new JScrollBar();
//Monumento mais Visto
Atracao monumento = lstAtracoes.monumetoMaisVisto();
try {
imagemMonum... |
35111258-e40b-4be3-bb2c-c4043a84fb8d | 1 | @Override
public void updateView() {
listModel.removeAllElements();
for (File p : controller.getModel().getFilesToExclude()) {
listModel.addElement(p);
}
excludedPathsList.setModel(listModel);
} |
dc2cc1e8-115b-4575-b128-a41cdb4da697 | 2 | @Override
public int hashCode()
{
return (sequence == null ? 0 : sequence.hashCode())
^ (value == null ? 0 : value.hashCode());
} |
9035a905-21d8-438d-9ed3-d88cf5d7c09f | 0 | public double getGyroAngle(){
return _gyro.getAngle();
} |
6bb97fc0-4420-4e62-b15a-e69b21165594 | 4 | public static String getHumanSpeed(Long speed) {
if (speed == null) {
return "";
}
String s = "";
double num = 0;
if (speed < 1024) {
num = speed;
} else if (speed < (1024 * 1024)) {
num = (double) speed / 1024;
s = "Kb/s... |
2d0e9a32-a30d-4b1c-84d9-bdf5d8504eb5 | 6 | public static int calcSoftFour(Session aSession, Lecture aLecture) {
int penalty = 0;
List<Student> studentsEnrolledInLec = aLecture.getEnrolledStudents();
for(Student student : studentsEnrolledInLec){
List<Lecture> studentsLectures = student.getEnrolledLectures();
List<Session> studentSessions = new ArrayL... |
25cf1b92-afe5-4f3d-92ee-7aa5e57370c2 | 8 | private static ConnectedComponent findComponent(Long2ShortHashMapInterface hm, long startKmer,
LongArrayFIFOQueue queue,
int k, int b2, int newFreqThreshold) {
ConnectedComponent comp = new ConnectedComponent();
... |
dc743b65-1188-4675-86ba-8a467dbffb24 | 4 | public static String[] print(int[] result) {
String[] w = new String[result.length];
for (int i=0; i<w.length; i++) w[i] = "";
for (int i=0; i<result.length; i++) {
for (int j=0; j<result.length; j++) {
if(j == result[i]) {
w[i] = w[i] + "Q";... |
11266e52-3fd3-460b-a274-d86c4091d8bf | 0 | public static void main(String[] args) {
Demo02 demo = new Demo02();
demo.method_1(10, 20,new MyHanderInt() {
@Override
public int doThis(int a, int b) {
return a+b;
}
});
} |
29e44317-d930-4692-99fe-d07ba50bb65f | 4 | @Override
public void actionPerformed(ActionEvent e) {
Component source = (Component) e.getSource();
if(e.getSource().equals(file)){
new FilePopup(dw).show(source,0,getHeight());
}else if(e.getSource().equals(edit)){
new EditPopup(paint).show(source,0,getHeight());
}else if(e.getSource().equals(di... |
c5642cc7-3c4c-48e9-92dc-5ee37c8826f6 | 9 | public void keyPressed(boolean[] keys, KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode==37) parent.cellsManager.shiftSelectButton(-1);// left
if (keyCode==39) parent.cellsManager.shiftSelectButton(1);// right
if (keyCode==8) parent.cellsManager.deleteLastChar();
if (keyCode!=37 && keyCode!=39 && keyCo... |
c3dee972-a93b-4dff-af03-87dd91190621 | 8 | @Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (qName.equals("LineString")) {
inLineString = false;
}
if (inCoordinate && inLineString && qName.equals("coordinates")) {
String[] data = coordinates.toString().trim().split("\\s+");
dou... |
f084b5dc-80ff-4443-bd47-cb38ce615403 | 6 | public void actionPerformed(ActionEvent e) {
String selected = e.getActionCommand();
if (selected == "ダイアログ") {
displayDialog();
} else if(selected == "exit") {
Pref.saveLayout(getX(), getY());
Pref.save(tp.getBColor(), tp.getSColor(), tp.getFontName(), String.valueOf(tp.getFontSize()));
System.exit(0... |
e40a98f1-1813-47aa-8120-c323ad71b6a4 | 8 | public static int[][] get(int x)
{
if(x == 1)
return level1;
else if(x == 2)
return level2;
else if (x == 3)
return level3;
else if (x == 4)
return level4;
else if(x == 5)
return level5;
else if (x == 6)
return level6;
else if (x == 7)
return level7;
else if (x == 8)
return leve... |
35a8ebee-83be-4387-b186-128933413a2e | 5 | public double getCond() {
if (cond == Double.MIN_VALUE) {
Double max = Double.MIN_VALUE;
Double min = Double.MAX_VALUE;
double[] sngValues = getSingularValues();
for (int idx = 0; idx < sngValues.length; idx++) {
if (sngValues[idx] > max) {
max = sngValues[idx];
}
if (sngValues[idx] < m... |
7409360a-e685-4080-b1b2-7851fcbce236 | 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... |
dc5b97e2-5878-4cf2-b8d3-55db77f00fd1 | 3 | @Override
public boolean containsAll(Collection<?> c) {
for (Object o : c) {
if (!typeKey.containsKey(o))
return false;
}
return true;
} |
63c4eec0-eecb-4975-adbe-b1cffff805cb | 0 | public void setPlayerSpawnLocation(Location playerspawn) {
this.playerspawn = playerspawn;
} |
206aedd4-7798-407d-9bd6-4938ac58f542 | 4 | public static void main(String[] rags) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String[] l = in.readLine().split(" ");
int n = Integer.parseInt(l[0]);
int total = n;
long c = Long.parseLong(l[1]);
ArrayList<Integer> chpts = new ArrayList<Integer>();
int... |
bbf1567b-2924-47c6-81e1-20543f201bae | 7 | public boolean addFrame(BufferedImage im) {
if ((im == null) || !started) {
return false;
}
boolean ok = true;
try {
if (!sizeSet) {
// use first frame's size
setSize(im.getWidth(), im.getHeight());
}
image = im;
getImagePixels(); // convert to correct format if necessary
analyzePixels... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.